colelinux 09-07-2003, 07:34 PM Hi, it's me again.. and i have a simple question.. lol, as usual.. (how many times have i repeated that)
Anyway, i just want to ask 2 question about Listbox.
1) How to apply Multiple Columns in Listbox?
2) Is it possible to different bg colors for different items?
I just need 2 colors actually, example
Line 1 = Blue
Line 2 = Red
Line 3 = Blue
Line 4 = Red
Thanks and much thanks.! :-)
chris00 09-07-2003, 08:11 PM hey
For the colors you will probably have to make your own control or use somebody elses. There are probably a few controls out there that do that but the normal listbox doesn't support that.
BlueDragon 09-07-2003, 09:54 PM Turn on multiline, and the colors, not sure about that one
Thinker 09-07-2003, 10:16 PM Where would he find this multiline thing in the listbox to turn on???
You can't have multiple columns in a normal listbox. You can set tab
stops using the SendMessage API function and then put tabs between
the text to simulate columns. A Listview control would give you real
columns.
BlueDragon 09-07-2003, 10:19 PM Sorry, thinking of ListViews and View 3 - Report
Chris J Locke 09-07-2003, 11:39 PM A listbox has columns to an extent.... that is, items are arranged in snaking columns, filling the first column, then the second column, and so on. The ListBox scrolls horizontally and displays the specified number of columns. (He says, quoting from the help...)
Its not the same as the listview command, where an item can have subitems. Depends on what you want to achieve.
If you want colours, you could use the MsFlexgrid - each cell can have its own colour. One column with multiple rows looks a bit like a listbox..... ;)
colelinux 09-08-2003, 01:19 AM I'm now using Listview... like bluedragon said.. the multilines... are there anything like that listview?
i tried MSflexgrid before using listview, i don't know how to use it... lol... are there any samples around?
colelinux 09-08-2003, 01:34 AM err. nope.. i'm not asking for multilines, but thanks :-) i'll try flexgrid later...
Chris J Locke 09-08-2003, 02:18 AM the flexgrid is quite simple. A nice powerful control. Think how Excel works, and you won't go wrong. Use 'additem' to put things in the grid, using the tab character to seperate data into columns - so, additem "test" & vbTab & "here" would put the 'test' in column 1 and 'here' in the next column. Set the row and column properties, and the 'text' property contains what is in that cell. Each cell can have its own color, formatting and even a picture. All handy stuff. It does take a bit of work getting used to, but the results are worth it.
colelinux 09-08-2003, 06:33 AM sounds like fun, everybody's talking about flexgrid in this board.. :p :p
Thinker 09-08-2003, 10:08 AM Just about anything you could ever want to know about using the
FlexGrid controls...
http://www.visualbasicforum.com/showthread.php?threadid=35110
Gruff 09-14-2003, 01:11 AM Just about anything you could ever want to know about using the
FlexGrid controls...
http://www.visualbasicforum.com/showthread.php?threadid=35110
I've used flexgrid heavily before and hflexgrid too. Of course they were populated by a DB. Don't both put a drain on system resources?
I don't know if anyone has tried this yet but I found that the listbox control in the Microsoft Forms 2.0 Object library does have definable columns. Its also easy to use. I am not sure but I think it is the library exposed in MS Office VBA. Is there some reason not to use this control in VB 6.0? It seems a bit clunky to me.
Flyguy 09-14-2003, 01:59 PM You are not allowed to redistribute the Microsoft Forms 2.0 controls.
The belong to Office and not to VB.
In the Code Library is also a colored listbox example by Volteface
Gruff 09-14-2003, 05:28 PM You are not allowed to redistribute the Microsoft Forms 2.0 controls.
The belong to Office and not to VB.
In the Code Library is also a colored listbox example by Volteface
Whoops!
Thank you, I did not know that.
I'll look in the code library.
|