Hi all.. This issue is driving me crazy..
This code raises index out of range exception for the messagebox:
private void MainTabs_Selected(object sender, TabControlEventArgs e)
{
if (MainTabs.SelectedTab.Name == "ActiveDirectoryTab")
{
ADServerSelect.Items[0].Selected = true;
MessageBox.Show(ADServerSelect.Items[0].Text);
}
}
But if the messagebox is the result of an event it works just fine:
private void MainTabs_Selected(object sender, TabControlEventArgs e)
{
if (MainTabs.SelectedTab.Name == "ActiveDirectoryTab")
{
ADServerSelect.Items[0].Selected = true;
}
}
private void testButton_Click(object sender, EventArgs e)
{
MessageBox.Show(ADServerSelect.Items[0].Text);
}
Any help would be greatly appreciated..