You can create a class something like this:
class ListBoxInformativeItem
{
private string value;
private string extraInfo;
public ListBoxInformativeItem(string value, string extraInfo)
{
this.value = value;
this.extraInfo = extraInfo;
}
public string Value
{
get { return this.value; }
set { this.value = value; }
}
public string ExtraInfo
{
get { return this.extraInfo; }
set { this.extraInfo = value; }
}
public override string ToString()
{
return this.value;
}
}
Now creta an object of this class and add to ListBox using Add method of it.
When added, you'll see value part of the object in the ListBox while extraInfo will be Hidden.
When you want to access the Hidden Value to can do something like this:
ListBoxInformativeItemlistBoxItem = ListBox.Items[0] as ListBoxInformativeItem;
if(listBoxItem != null)
{
MessageBox.Show(listBoxItem.ExtraInfo);
}
You can also add all items to and array using the above thing in a loop and then send to other forms.
I hope this will help.
Best Regards,
Rizwan aka RizwanSharp