Instead of adding strings to your listbox, add objects with a
ToString()
override that puts what you want in the listbox. That way, when you get the selected index, you can access the properties of the object (with the proper casting of course).
public class MyItem
{
public string Text { get; set; }
public int Value { get; set; }
public override ToString()
{
return this.Text;
}
}
if (((MyItem)(listbox.SelectedItem)).Value == 0)
{
...
}