I'm new to C# and could use some help! :) I have two questions that I'm sure are actually very simple to you all.
I have a windows form with a tabControl and a "Select" button on it. The tabControl consists of 6 tabs. Each tab has a listBox on it with different data for each tab.
What I'm wondering is how would I be able to find out (once the select button is clicked) if ALL of the listBoxes values are -1 (no selection)? I was successfully able to do this for one listBox, but I cannot seem to have it check them all. Here is my code for it to find out if the ONE listBox does not have a selection:
if (listTopics.SelectedIndex < 0)
{
MessageBox.Show("Nothing is selected");
}
else
{
MessageBox.Show("Something is selected");
}
I hope this makes sense... That's only for the first list box, but I want it to check them all to see if an item is selected.And for my second question,
Once I get that frustration above out of the way, I have a label on a different form that I want to display the text from whatever item is selected out of the 6 listBoxes... Is this possible?
Thanks for your time and sorry for the long post.
-Trevor


Sign In
Create Account

Back to top









