By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,395 Members | 2,537 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,395 IT Pros & Developers. It's quick & easy.

Multicolumn Listbox

P: n/a
WRH
Hello
I want to have a multicolumn listbox. I never used one before
so I looked at a Help example. I set the multicolumn property and
the column width and tested with this example...

this.listBox3.Items.AddRange(new object[]
{
"Item 1, column 1",
"Item 2, column 1",
"Item 3, column 1",
"Item 4, column 1",
"Item 5, column 1",
"Item 1, column 2",
"Item 2, column 2",
"Item 3, column 2" });

It works perfectly, with column 1 items is column one and column 2
items in column 2. Now here's why I posted...I don't understand the
example! What is there that results in a two column list with 5 lines
in column 1 and 3 lines in column 2?


Oct 22 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi,

Each object is a comma separated list of values so I assume that the listbox
expect that you define the columns that way.

You failed to mention if this is a web or a win example ( I assume that a
window)

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"WRH" <no****@videotron.cawrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Hello
I want to have a multicolumn listbox. I never used one before
so I looked at a Help example. I set the multicolumn property and
the column width and tested with this example...

this.listBox3.Items.AddRange(new object[]
{
"Item 1, column 1",
"Item 2, column 1",
"Item 3, column 1",
"Item 4, column 1",
"Item 5, column 1",
"Item 1, column 2",
"Item 2, column 2",
"Item 3, column 2" });

It works perfectly, with column 1 items is column one and column 2
items in column 2. Now here's why I posted...I don't understand the
example! What is there that results in a two column list with 5 lines
in column 1 and 3 lines in column 2?


Oct 22 '07 #2

P: n/a
WRH
Thanks for the quick reply.
Further testing shows that the last 3 items went into column 2 only
because of the height of the listBox (No vertical scroll) What I want
is to specify the column for an item.

Using windows forms, MS VC# 2005 express edition
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi,

Each object is a comma separated list of values so I assume that the
listbox expect that you define the columns that way.

You failed to mention if this is a web or a win example ( I assume that a
window)

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"WRH" <no****@videotron.cawrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>Hello
I want to have a multicolumn listbox. I never used one before
so I looked at a Help example. I set the multicolumn property and
the column width and tested with this example...

this.listBox3.Items.AddRange(new object[]
{
"Item 1, column 1",
"Item 2, column 1",
"Item 3, column 1",
"Item 4, column 1",
"Item 5, column 1",
"Item 1, column 2",
"Item 2, column 2",
"Item 3, column 2" });

It works perfectly, with column 1 items is column one and column 2
items in column 2. Now here's why I posted...I don't understand the
example! What is there that results in a two column list with 5 lines
in column 1 and 3 lines in column 2?



Oct 22 '07 #3

P: n/a
Hi,

You have to read the docs and see what format ListBox expect for
multicolumns lists.

I just found the txt:
A multicolumn ListBox places items into as many columns as are needed to
make vertical scrolling unnecessary. The user can use the keyboard to
navigate to columns that are not currently visible. Set the
HorizontalScrollbar property to true to display a horizontal scroll bar that
enables the user to scroll to columns that are not currently shown in the
visible region of the ListBox. The value of the ColumnWidth property
determines the width of each column.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"WRH" <no****@videotron.cawrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Thanks for the quick reply.
Further testing shows that the last 3 items went into column 2 only
because of the height of the listBox (No vertical scroll) What I want
is to specify the column for an item.

Using windows forms, MS VC# 2005 express edition
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:%2****************@TK2MSFTNGP03.phx.gbl...
>Hi,

Each object is a comma separated list of values so I assume that the
listbox expect that you define the columns that way.

You failed to mention if this is a web or a win example ( I assume that a
window)

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"WRH" <no****@videotron.cawrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>>Hello
I want to have a multicolumn listbox. I never used one before
so I looked at a Help example. I set the multicolumn property and
the column width and tested with this example...

this.listBox3.Items.AddRange(new object[]
{
"Item 1, column 1",
"Item 2, column 1",
"Item 3, column 1",
"Item 4, column 1",
"Item 5, column 1",
"Item 1, column 2",
"Item 2, column 2",
"Item 3, column 2" });

It works perfectly, with column 1 items is column one and column 2
items in column 2. Now here's why I posted...I don't understand the
example! What is there that results in a two column list with 5 lines
in column 1 and 3 lines in column 2?




Oct 22 '07 #4

P: n/a
WRH
Thanks again for the info.

I have decided to use ListView instead, as it seems much
more manageable with regard to columns.

I could not be sure what the user may see at any given
time with a multicolumn ListBox!

"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:u9****************@TK2MSFTNGP02.phx.gbl...
Hi,

You have to read the docs and see what format ListBox expect for
multicolumns lists.

I just found the txt:
A multicolumn ListBox places items into as many columns as are needed to
make vertical scrolling unnecessary. The user can use the keyboard to
navigate to columns that are not currently visible. Set the
HorizontalScrollbar property to true to display a horizontal scroll bar
that enables the user to scroll to columns that are not currently shown in
the visible region of the ListBox. The value of the ColumnWidth property
determines the width of each column.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"WRH" <no****@videotron.cawrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>Thanks for the quick reply.
Further testing shows that the last 3 items went into column 2 only
because of the height of the listBox (No vertical scroll) What I want
is to specify the column for an item.

Using windows forms, MS VC# 2005 express edition
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote
in message news:%2****************@TK2MSFTNGP03.phx.gbl...
>>Hi,

Each object is a comma separated list of values so I assume that the
listbox expect that you define the columns that way.

You failed to mention if this is a web or a win example ( I assume that
a window)

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"WRH" <no****@videotron.cawrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl.. .
Hello
I want to have a multicolumn listbox. I never used one before
so I looked at a Help example. I set the multicolumn property and
the column width and tested with this example...

this.listBox3.Items.AddRange(new object[]
{
"Item 1, column 1",
"Item 2, column 1",
"Item 3, column 1",
"Item 4, column 1",
"Item 5, column 1",
"Item 1, column 2",
"Item 2, column 2",
"Item 3, column 2" });

It works perfectly, with column 1 items is column one and column 2
items in column 2. Now here's why I posted...I don't understand the
example! What is there that results in a two column list with 5 lines
in column 1 and 3 lines in column 2?




Oct 22 '07 #5

P: n/a
Hi,
--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"WRH" <no****@videotron.cawrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Thanks again for the info.

I have decided to use ListView instead, as it seems much
more manageable with regard to columns.

I could not be sure what the user may see at any given
time with a multicolumn ListBox!
Wise decision, Listview is the control for that.
Oct 23 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.