Elaborating on previous answer by Pir Fahim, he's right but i'm using selectedItem.Text (only way to make it work to me)
Use the SelectedIndexChanged() event to store the data somewhere. In my case, i usually fill a custom class, something like:
class myItem {
string name {get; set;}
string price {get; set;}
string desc {get; set;}
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
myItem selected_item = new myItem();
selected_item.name = listBox1.SelectedItem.Text;
Retrieve (selected_item.name);
}
And then you can retrieve the rest of data from a List of "myItems"..
myItem Retrieve (string wanted_item) {
foreach (myItem item in my_items_list) {
if (item.name == wanted_item) {
// This is the selected item
return item;
}
}
return null;
}