Tab control problem...

J

Jeti [work]

I have tab control with several tab pages. Each tab page contains a few
textboxes filled dynamicly from the code. Everything goes fine, but every
textbox that is located on a tab page that has hot been selected after the
form has been activates has no text! Let me try to describe my problem
further:


TAB CONTROL
PAGE PAGE PAGE PAGE
------------------------------------
TXT1 TXT3 TXT5 TXT7
TXT2 TXT4 TXT6 TXT8
------------------------------------

BUTTON(CLOSE)

On form load goes:
TXT1.Text = "my";
TXT2.Text = "form";
TXT3.Text = "isnt";
TXT4.Text = "working";
TXT5.Text = "right";
//etc...


By default, when form openes, the first tab page is focused, and other have
never been focused. When I close this dialog, and set a breakpoint, i get
this odd results:

Button_Close_Click (...)
{
Debug.WriteLine (TXT1.Text);
Debug.WriteLine (TXT1.Text);
}
 
J

Jeti [work]

Sorry, last post was somehow ruined, and posted unfinished... here's the
whole post:
------------------------

I have tab control with several tab pages. Each tab page contains a few
textboxes filled dynamicly from the code. Everything goes fine, but every
textbox that is located on a tab page that has hot been selected after the
form has been activates has no text! Let me try to describe my problem
further:


TAB CONTROL
PAGE PAGE PAGE PAGE
------------------------------------
TXT1 TXT3 TXT5 TXT7
TXT2 TXT4 TXT6 TXT8
------------------------------------

BUTTON(CLOSE)

On form load goes:
TXT1.Text = "my";
TXT2.Text = "form";
TXT3.Text = "isnt";
TXT4.Text = "working";
TXT5.Text = "right";
//etc...
Exactly, textboxes are binded to a strong-typed dataset, but that isnt a
problem...


By default, when form openes, the first tab page is focused, and other have
never been focused. When I close this dialog, and set a breakpoint, i get
this odd results:

Button_Close_Click (...)
{
Debug.WriteLine (TXT1.Text); // writes "my" - ok.
Debug.WriteLine (TXT2.Text); // writes "form" - ok
Debug.WriteLine (TXT3.Text); // writes "" - ????
Debug.WriteLine (TXT4.Text); // writes "" - ????
Debug.WriteLine (TXT5.Text); // writes "" - ????
Debug.WriteLine (TXT6.Text); // writes "" - ????
// every control that has been on some tab
// page that was never focused, has no text set!
// WHY?!
}



Sorry for my bad english, i hope you understood me!
Thank you for replies!
 
M

Mick Doherty

Have you tried setting the bindingcontext of each tabpage at form load.

\\\
foreach(TabPage tp in this.tabControl1.TabPages)
{
tp.BindingContext = this.BindingContext;
}
///

This problem only occurs on DataBound controls and is not specific to
TabControls. You will see this behaviour on any control whose visibility
changes (when a tabpage is not selected it is not visible).
 
J

Jeti [work]

Have you tried setting the bindingcontext of each tabpage at form load.
\\\
foreach(TabPage tp in this.tabControl1.TabPages)
{
tp.BindingContext = this.BindingContext;
}
///

This problem only occurs on DataBound controls and is not specific to
TabControls. You will see this behaviour on any control whose visibility
changes (when a tabpage is not selected it is not visible).

I've just tried this, and it does not help... Anyway, thank you for the
reply...
Anyone else has any solutions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top