Reputation:
When I click on a tab, so it shows the content of that tab page but I want to do an action when the tab is selected, for example when I click on "finance tab" there would be a combobox in the Finance Tab, that combobox should fill with the data from sql server, is it possible ?
Upvotes: 2
Views: 4502
Reputation: 8647
You can use the TabControl.SelectedIndexChanged Event
Private Sub TabControl1_SelectedIndexChanged(sender as Object, e as EventArgs) _
Handles TabControl1.SelectedIndexChanged
'suppose your *finance tab* instance is TabPageFinance
If TabControl1.selectedtab is tabPageFinance
'do stuff
End if
'or suppose *finance tab* index is 0
If TabControl1.selectedindex = 0
'do stuff
End if
End Sub
Upvotes: 5
Reputation: 5719
Yes it is possible !!
You can use panel with combobox in it
About how to fill combobox fill with your data you can see this link
http://vb.net-informations.com/dataset/bind-combobox.htm
Upvotes: 0