Reputation: 320
In my application i'm programmatically adding a tab like so:
'show searchresults tab if not present
If Not TabControl1.TabPages.Contains(tabSearchresults) Then
TabControl1.TabPages.Insert(3, tabSearchresults)
End If
Now I cant seem to manually add a click event listener to that tab in design view, and when I do so in codeview nothing happens when I click that tab.
So the question is,.. How do I add a click listener to that tabSearchresults tab?
Upvotes: 0
Views: 1135
Reputation: 32445
I assume that your tabSearchresults
is your TabPage
.
So first create a function which will be handler of Click
event
Private Sub tabSearchresults_Click(sender as Object, e as EventArgs)
'your code ...
End Sub
Then after line where you initialize your TabPage
add this handler:
tabSearchresults = New TabPage()
AddHandler tabSearchresults.Click, AddressOf tabSearchresults_Click
Upvotes: 2