Hi,
I have two listboxes on my form and I want to update listbox2 whenever an iem in listbox1 is clicked. For example,
Listbox1 will have category names like countries; USA, Canada, UK, France and so on. And Listbox 2 will have city names for each country. I started with something like
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if ( (string)listBox1.SelectedItem == "USA" )
{
listBox2.Items = "New York, Houston, Boston";
}
else if ((string)listBox2.SelectedItem == "UK")
{
listBox2.Items = "London, Manchaster";
}
I don't know what to write instead of "listbox2.items". Any ideas?

1 answers
Something like this should work:
answered one year ago by:
17279
108
Well, that did what I needed, thank you very much.