User settings and splitcontainer issue

G

Guest

I'm having a problem when using multiple splitcontainers on a form and saving
user settings for the SplitterDistance. Here's a description:

I place one splitcontainer in my bare form, add a project setting called,
e.g., splitDist1 which is an int user setting, and attach it to the
SplitterDistance under Application Settings in VS2005. On the form_closing
event I add Properties.Settings.Default.Save(). When I start the application
and move the splitter around, the value is stored and if I then shutdown and
restart the form, the splitter will start in the location when I last exited.
Perfect.

However, if I now add another splitcontainer in panel1 of the first
splitcontainer and follow the same procedure above to add a user setting
called splitDist2, the value for splitDist1 no longer seems to be saved
properly. If I resize the panels on both splitcontainers, splitContainer2's
value will be saved but the SplitterDistance property for splitContainer1 is
always started back at its initial location.

I've tried adding a third splitcontainer into a panel of the second just for
testing and things get even weirder. It appears that something's getting
confused and those settings aren't being stored properly. I don't know
whether I'm not doing something correctly (which is entirely possible) or
whether this is some sort of glitch in something else.

Any help would be appreciated!
 
G

Guest

One more piece of information: If I take a bare form and add 2
splitcontainers but *don't* embed one in a panel of the other, saving the
properties works fine. The problem only arises when one panel is embedded in
another.

Jeff
 

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

Top