Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Tab Control Problem
 

Tab Control Problem

I have a tabcontrol at my form which contains 5 tabs and the 5 tabs have some labels, textboxes and other.

The problem, i face is that when i set the text property ofa textbox of every tab, the value that i set, stays only at the tab the was visible when was done the setting of the values, and all the other values at the textboxes that isn't visible, are lost when i click at their tab button in order to be seen.

Is this a bug or something, because i done a project only with a tab control with 5 tabs, set a value at one textbox of every tab and when i load it only the textbox of the first tab has a value in it, all the others doesn't have any value or have it till i click at their tab button in order to bring in front the tab

thank you all in advance and any help is appreciated !!

Greg_59100  Tuesday, April 15, 2008 10:44 AM

Hi Greg_59100,

Based on my understanding, you are trouble is that when you set each control's Text property on TabControl's TabPage, you can only see the value when you select it. If I have misunderstood you, please feel free to tell me, thanks.

If just made an test program for you, unfortunately, I cannot reproduce your issue. This is the source code of my test program. Hope this can help you out.

I set each TextBox's Text Property in the FormLoad event handler. I display them in the Button1's Click event handler.

Code Snippet

private void MainForm_Load(object sender, EventArgs e)
{
this.textBox1.Text = "TestValue1";
this.textBox2.Text = "TestValue2";
this.textBox3.Text = "TestValue3";
this.textBox4.Text = "TestValue4";
this.textBox5.Text = "TestValue5";

}

private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(this.textBox2.Text+this.textBox3.Text+this.textBox4.Text+this.textBox5.Text);
}

Regards,

Samson Zhou

jsj_Samson  Saturday, April 19, 2008 3:01 PM

Hi Greg_59100,

Based on my understanding, you are trouble is that when you set each control's Text property on TabControl's TabPage, you can only see the value when you select it. If I have misunderstood you, please feel free to tell me, thanks.

If just made an test program for you, unfortunately, I cannot reproduce your issue. This is the source code of my test program. Hope this can help you out.

I set each TextBox's Text Property in the FormLoad event handler. I display them in the Button1's Click event handler.

Code Snippet

private void MainForm_Load(object sender, EventArgs e)
{
this.textBox1.Text = "TestValue1";
this.textBox2.Text = "TestValue2";
this.textBox3.Text = "TestValue3";
this.textBox4.Text = "TestValue4";
this.textBox5.Text = "TestValue5";

}

private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(this.textBox2.Text+this.textBox3.Text+this.textBox4.Text+this.textBox5.Text);
}

Regards,

Samson Zhou

jsj_Samson  Saturday, April 19, 2008 3:01 PM

You can use google to search for other answers

Custom Search

More Threads

• Inherited controls not visble in the designer view of a form
• Group Box Value
• Label inside usercontrol re-initializes whenever I build/load the designer.
• MyControl shows twice in the Toolbox why?
• How to add a right click context menu to DesignerActionMethod items?
• Syntax Highlighting
• RichTextBox Language
• Undo/Redo does not preserve order of Container.Add calls on Redo
• How can Restrict a model form or Dialog form in ClientRectangle of MDI form.
• scrolling message