event for tab or radio button change

kernel843

New member
Joined
Sep 2, 2008
Messages
2
Programming Experience
Beginner
Hi All,

I'm a relative noob when it comes to VB.NET and need some help. I've gone through all the list of events and tried the ones that looked like they make sense, but I can't figure this out.

I've got a windows form with multiple tabs using TabControl. If a particular tab is clicked I'd like to execute a particular event, similar to a form load on 1 form.

I also need to capture a change of a radio button in a groupbox, so if the checked radiobox in the group changes, I'd like to execute something else.

Any help would be greatly appreciated.
 
I would say documentation is first stop to learn a class that is new to you, for example search up Tabcontrol class and select "events" then browse the list. Once you've figured an event that may be used let IDE generate an event handler (like you see Form Load handler sub). This is done either from Properties window in Design view, you can set view to Events, or by using the two top objects/events combos in Code view.

In this case another IDE tool may be helpful for you in finding an appropriate event. Start the Object Browser from View menu, search up either TabControl or RadioButton class (they are both in System.Windows.Forms namespace). In the class members pane filter out inherited members by using the context menu and untick "show inherited members", also do the same to change view to "group by member type". Now you can quickly see that RadioButton only has two events specific to that class that is not inherited from Control class. Same with Tabcontrol, it only has a few control specific events. In both cases you can actually see at an eye glance which events you want to use. You can also from Object Browser press F1 key to go directly to a help topic.

The answers you should be arriving at is RadioButton.CheckedChanged and TabControl.Selected (or SelectedIndexChanged), but I hope you see the value of learning to handle the tools mentioned above, and that you try to use them to do this particular exercise.
 
Back
Top