Is there a way to set the selected tab of a tabControl without the selectedIndexchanged event firing?
e.g. Here the event fires when selecting myTabPage2 because myTabPage1 is the default:
Private Sub setupTabControl
If blnHasAccount=true then
MyTabControl.selectedTab=myTabPage1
else
MyTabControl.selectedTab=myTabPage2
End if
End sub
Private Sub MyTabControl_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyTabControl.SelectedIndexChanged
'Do stuff (but only when user has actually changed the tab themselves)
End Sub
When you set the new tabpage you could remove the event handler
It’s important to enclose everything in a Try Finally to recover correctly from exceptions