views:

61

answers:

1

i have designed a tabbed page. im able to load forms in the tabs and even im able to navigate thru the child forms.but the problem here is im not able to load the directly,i had to write the code to load the form in tabPage1_Click(object sender, EventArgs e) event. Is there any way to load the form directly that is while opening the gui it shud be initialized wid first form. ihave tried to initialize it in constructor but it is not coming.

waiting for replies!!

A: 

You can add your tab initialization code to the Load event of your parent form. The load event will be called whenever you show the form.

If you add this manually (not via the designer) you can add something like this to the form constructor, after the InitializeComponent() call:

this.Load += new EventHandler(Form1_Load);

Then do the initialization within the Form1_Load method:

private void Form1_Load(object sender, EventArgs e)
{
    // Initialize tab code here...
}
Rhys Jones
Thanks Dude!!! its working.
srinivas
@Srinivas, Why dont you mark this answer?
Sauron