You can add any type of object you want to a listbox as an item. That means
you can create a class with a all the data you want, simply override the
ToString() method, and add it to a listbox. For example:
private class TestClass
{
public string name = "shane";
public int value = 282;
public override string ToString()
{
return name;
}
}
.....
TestClass t = new TestClass();
listbox1.Items.Add(t); // listbox1 will show an item named "shane"
Chances are that you have already created a class and you just need to
override the ToString method so that it is displayed properly.
ShaneB
"Tome73" <To****@discussions.microsoft.com> wrote in message
news:03**********************************@microsof t.com...
xHow do I create a new item in a list box that has a different value then
the
text? When using the add method the value and the text are the same. I'm
really surprised that listbox1.Items.Add("value", "text"); doesn't work.
So
how can I do this? Thanks.