Listbox Question (C#)

niv

Member
Joined
Jun 3, 2003
Messages
9
Listbox Question

I have 2 columns that I need to return from SQL into a
listbox.

UNIQUEID , FIRSTNAME

FirstList.Items.Add(myRow.ItemArray.GetValue(5).ToString
());

The code above only adds 1 item to a row...

Anyone know how to add 2 entries for every row in the
listbox?

niv
 
Heres one way:

listMylist.Items.Clear();
string s1 = somedate;
string s2 = moredata;
string str = s1 + s2;
listMylist.Items.Add(str);
 
You should look at the ListView control (read about it in the MSDN). It supports multiple columns, like the file explorer pane in My Computer, when youre in Detail View.
 
Back
Top