We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Navigate tabs in a Winforms Tab Control

Medium Priority
720 Views
Last Modified: 2012-05-11
Hello Experts:

I have a winforms tab contol on my main form.  It has, say, 5 tab pages. (tabPage1, tabPage2 etc)

On myTabControl..TabPages[tabPage1] I have added a custom UserControl (userControl1) with a Button (button1) on it.

When I click button1 I want to clear the controls on tabPage3, Add() a new UserControl to that TabPage, then select tabPage3.

How do I wire up the button1_Click event handler to talk to the TabControl and select the appropriate tab?

Should be easy enough, I'm just missing something here..

Thanks

RW
Comment
Watch Question

High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
OK - that's what I am working on at the moment - I just wanted to see if there was any sneaky way of referencing the parent control and passing the event that way -

I'll get back asap with how it works out.

RW
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
CERTIFIED EXPERT
Top Expert 2009

Commented:
You could also pass in a reference to tabPage3 into your UserControl if you really wanted to...I prefer the event method though.

Author

Commented:
Custom event is the best way to go rather than passing parameters back and forth between parent and child controls - just more to declare and wire up.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.