TabControl1.TabPages.Contains Problem in VB.NET
Posted on 2006-06-12
Hey everyone I have a question that really bugging me. I read an example on msdn about how to check to see if a specified tab has already been created so I code the following
'Bring up a new tab that lets you set the properties for that event
Dim myTabPage As New TabPage
myTabPage.Text = gridActiveEvent.Item(gridActiveEvent.CurrentCell.RowNumber, 2) & ":" & gridActiveEvent.Item(gridActiveEvent.CurrentCell.RowNumber, 0)
'Make sure tab wasn't already created
If TabControl1.TabPages.Contains(myTabPage) = False Then
TabControl1.SelectedTab = (myTabPage)
The code doesn't work and a new tab is created even though the tab already exists. Debug.wrote wrote this
Both times i ran this code, the the tabs are the same.
Thanks in advance for the help guys.