Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TabControl Issue 1

Status
Not open for further replies.

mlager

Programmer
Sep 1, 2006
74
US
I've got a form with a tab control where I have different settings on each tab. The settings are stored as user settings. I'm having a problem where settings are erased unless I flip through ALL tabs. I can't figure out whats going on.

I.E.

TAB 1 contains a folder path
TAB 2 contains a username
TAB 3 contains a fullname

If I switch directly from TAB 1 to TAB 3 and update, TAB 2 gets erased. If I switch from TAB 1, to TAB 2, to TAB 3 and then update TAB 3, TAB 2 doesn't get erased.

Any advice?
 
Are you doing some kind of loading while opening the tabs?
 
Each tab has a few text fields on it, and I am assigning the value of each text field to a user setting. In the sub for each textbox I have something like this:

My.Settings.Username= TextBox1.Text

If I put all of the fields from each tab onto one form outside of the tab control, all the data saves properly. It's when they are each on different tabs that is causing the problem. Sort of like each setting gets set to NULL unless you click on the tab where that setting exists and it loads the whatever the user setting is currently set to.

Does that make sense?
 

The question is: where in the code do you assign the values to any text boxes? I bet you do it in :
Code:
    Private Sub your_tab_name_Selecting(ByVal sender As Object, ByVal e As System.Windows.Forms.TabControlCancelEventArgs) Handles your_tab_name.Selecting
so you have to actually click on the tab to populate any text boxes on that tab, otherwise they all are empty.

If you move all that logic into Form_Load event instead, you will be set.

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top