Bound textbox not filled if tabPage has not been viewed

T

Tom

I have a form with a tabControl with 6 tabPages. There are
textBoxes on all the tabPages that are bound to a dataset.
The user can click a modify button, edit whatever
textBoxes they want and then click an OK button. The OK
button handler loops over all the textBoxes on all the
tabPages to validate their contents.
The problem is that the textBoxes on any tabPage which has
not been viewed appear empty to the code. It appears that
VB does not fill in bound textBoxes until the tabPage is
viewed (the tab clicked on by the user). Hence my
validation code thinks these textBoxes .text properties
are null and complains. I have kludged around this by
having the validation code select each tabPage in turn.
This works, but the user sees all the various tabPages
rapidly exposed after they hit the OK button.
Is there a better solution?
Thanks
 
C

Cor Ligthert

Hi Tom,

It appears that
VB does not fill in bound textBoxes until the tabPage is
viewed (the tab clicked on by the user).

Right, do not use the value in the textbox however the underlaying data.

I hope this helps?

Cor
 
T

Tom

It confirms what I suspected.
Most, but not all of the textboxes are bound to columns in
a dataset. I presently loop over all the controls as a
convenient way to do the validation. It avoids having a
bit of specific code for each column.
Is there an easy way using only the information from the
textbox object (including the binding information) to get
the value of the underlying data? If so then I could
manage to make this work without a major architectural
change.

thanks
 
C

Cor Ligthert

Hi Tom,

Show some code how you fill your textbox (probably bound it), than I try to
tell you how you get your information from the source, mostly that needs
less (more unified) code.

Cor
 
A

Agnes

Dear Tom,
Can you solve the problem now ????
I got this same problem also, but I can't seek any solution

From agnes
 

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

Similar Threads


Top