I'm trying to load a form with different information depending on which component of my listbox I double click. If I get which box was clicked(box 1, box2, etc.), that would be enough.
I've tried using the Doubleclick event, but it returns an object, and I'm not quite sure what to do with this object to get what I need.
Heres my code right now:
for (int i = 0; i <= (Program.Customers.Count) - 1; i++)
{
if (Program.Customers[i].Name == searchTerm)
{
SearchIndex.Add(i);
listBox1.Items.Add(((Program.Customers[i].ID + " - " + Program.Customers[i].Name)));
}
}
listBox1.Show();
What would be the best way to get which box was clicked? I need the ID, but I can get that with box was clicked.
Thanks!
ListBox listBox = sender As ListBox;.void listBox1_DoubleClick(object sender, EventArgs e).