C# tabcontrol loading tabs problem

tab loading 3 times at startup.

Page 1 of 1

1 Replies - 5778 Views - Last Post: 23 June 2009 - 07:59 AM Rate Topic: -----

#1 Servatis   User is offline

  • D.I.C Regular

Reputation: 48
  • View blog
  • Posts: 394
  • Joined: 30-March 09

C# tabcontrol loading tabs problem

Posted 22 June 2009 - 03:39 AM


So this is not a very big problem. the program works fine but;
I have an application that has some option to dynamically change some settings for example I change the language setting and the current tab page gets reloaded with the right language.

now at start-up the application loads the first tab but then the application loads the language method effectively reloading the page again.
also in the Form_Load method at the end the application runs through all tabs loading the information, because if I dont do this and certain settings are changed they will not be carried over to the other tabs.
for example I load the app, I immediately, without accessing tab 2 or 3, change a setting called MXorSX, and I then switch to tab 3 the old data will still be displayed until I deliberately select the data that I want displayed, the only solution I found was to access all tabs when the app is loaded.

what this does is it loads tab 1, 3 times when the application is started. because the app starts at tab 1 it gets loaded the first then the language method is called along with all other methods that need to be used at startup and then at the end of Form_Load it runs through all tabs again.

Now I can prevent the app from loading the tab when the language method is called with a simple bool.

but then it still gets loaded 2 times which is 1 to many.

in my code I only call on tab 1 once, so I'm assuming that there is some code somewhere that, when the app is started, loads tab 1, then my code loads everything that is needed and I again load tab 1.
tab 1 doesn't necessarily have to be loaded until I call for it.

is there a way to prevent it from loading before Form_Load is called.
or is there a reason for it loading before anything else?

I'm not posting code because it's quite a lot and only a few lines matter.
if you do want to see some code then ask, but I don't think it will be much help.

I hope I explained it correctly.


Is This A Good Question/Topic? 0
  • +

Replies To: C# tabcontrol loading tabs problem

#2 PsychoCoder   User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1659
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: C# tabcontrol loading tabs problem

Posted 23 June 2009 - 07:59 AM

First off I'm moving this to the ASP.NET forum (it belongs there since you're referencing the Form_Load event). Second, show us the code that is causing the issue(s). It's hard (near impossible) for us to help if we cannot see how you're accomplishing this :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1