Given the following code, how is that I receive an ArguementOutOfRangeException?
if (comboBox1.Items.Count > 0)
{
comboBox1.SelectedIndex = 0;
}
This code is in my forms Load event. I know the combo box has items in it, but yet I cannot set the selected index. MSDN says that the ArguementOutOfRangeException is thrown if the specified index is less than or equal to -2, or if it is greater than or equal to the number of items in the combobox.
The quick test app I just wrote doesn't exhibit the same problem - what could be going on?