Click here to Skip to main content
14,494,237 members
Rate this:
Please Sign up or sign in to vote.
I need to save the tabs of my TabControl, so when the user next launches, it will have the original tabs opened. (Like Notepad++, but in C#)

If I can, I'd like to write the TabControl to a file and re-load it at next launch.

Thanks :)

What I have tried:

I tried to create an App Setting in the Properties menu, and I thought it "worked", but when I attempted to run it, it throws an error stating it doesn't know how to "get" the TabControl's values. I assume it's because the App Setting area isn't meant for a TabControl? Or am I doing something wrong?
Posted
Updated 25-Mar-20 18:40pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

You cannot save the control itself. That doesn't even make sense. You can, however, save the information you used to create that tab. When the app launches again, load the information and recreate the tabs as you did before.
   
Comments
The Magical Magikarp 27-Mar-20 19:03pm
   
Hmm? Could you elaborate some more? :D I guess I don't fully understand
The Magical Magikarp 27-Mar-20 19:10pm
   
Could I write my TabControl to an XML file, or, better yet, an XML Schema file? It seems logical, at least from my point of view :D
Dave Kreskowiak 28-Mar-20 23:04pm
   
Again, you cannot save the controls themselves.

You created the tab pages in your code, did you not? You supplied some method somewhere in your code the information it needed to create that tab page, did you not? You save that information to a file and just read that data back later and supply it to the method that created the tab pages.
The Magical Magikarp 30-Mar-20 17:37pm
   
That makes sense.. I'll try it out!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100