I have a tabcontrol and two tab pages on the tab control. There are some fields on the tab pages which are databound to access database table which are populated using dataadapter. There is functionality to calculate total of the fields on both the tab pages when I click a button. When I load the form the record is retrieved and all the fields are populated with data. when I click the button without navigating to the second tab page then the total is calculated only for the fields that are on the front (first) tab page. It does not include the fields on the second tab page in calculations. When I navigate on the second tab page and then hit the button then the calculations are correct.
I saw that, for the cotrols on the second tab page, databinding does not happen until I navigate to the tab page. When I navigate to the second tab page then only the controls get the data. And this makes the difference in calculations when I just load the data and hit the button. It thus takes only the fields from the first tab page in calculation as the fields on the second tab pages are still not populated with data.

I want the fields on the second tab page also to get populated with data as soon as the data is loaded and not when I actully navigate to the tab page.
Any solution to this problem?

Recommended Answers

All 3 Replies

you have to control the data population from within the form_Load procedure. this would
populate the controls with all necessary data immediately the form is loaded or started up

you have to control the data population from within the form_Load procedure. this would
populate the controls with all necessary data immediately the form is loaded or started up

If I understood correctly, you mean not to use the databinding and handle the data manually. But isn't there anywork-around for this?

yes, ukshir.....writing your codes to create your own objects are more flexible and
very easy for you to manipulate

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.