Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / December 2004

Tip: Looking for answers? Try searching our database.

controls init from registry

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
palaga - 26 Dec 2004 19:37 GMT
Where is the best place to put some code to load my form's controls
parameters from the registry, and to save them to registry ?
I have 2 functions in my form : loadFromRegistry and saveToRegisttry, that
recursively load/save my controls & custom controls parameters..
I tried to call myMainWindow.loadFromRegistry in Main(), after the 'new
MyMainWindow( )' and before the myMainWindow.Run( ) : it seems to work
But If I call the SaveToRegistry after the myMainWindow.Run( ), it seems
that some controls have already lost data (for example I have a listview in
a custom control that is in my form, and when I call SaveToRegistry after
'Run', this listview is empty although it had items before...)

So is there an event or a more apropriate place to init and save controls
preferences in a form ?
(same question would apply for calling serialize() and deserialize() )
thanks
Bob Powell [MVP] - 26 Dec 2004 23:25 GMT
The easiest way is to use the Microsoft.VisualBasic namespace and the
SaveSetting / GetSetting methods.

Signature

Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

> Where is the best place to put some code to load my form's controls
> parameters from the registry, and to save them to registry ?
[quoted text clipped - 11 lines]
> (same question would apply for calling serialize() and deserialize() )
> thanks
palaga - 27 Dec 2004 07:56 GMT
I have no problem reading from or writing to the registry or knowing where
to write/read in the registry. All I would like to know is what is the best
moment to do it !
is there an event in the form that I can use to load or save settings ?
If I save settings after the Run( ) method returns, it is to late ! so When
should I load / save settings ?

> The easiest way is to use the Microsoft.VisualBasic namespace and the
> SaveSetting / GetSetting methods.
[quoted text clipped - 16 lines]
>> (same question would apply for calling serialize() and deserialize() )
>> thanks
Bob Powell [MVP] - 27 Dec 2004 11:32 GMT
Ahh I see. Generally you can load and save at any time. Even read from the
registry when you need to read a value. If you have a lot of user
preferences though you might wish to get them in the OnLoad override of the
main form and save all the settings in the Closing or Closed event.

Signature

Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

> I have no problem reading from or writing to the registry or knowing where
> to write/read in the registry. All I would like to know is what is the best
[quoted text clipped - 23 lines]
> >> (same question would apply for calling serialize() and deserialize() )
> >> thanks
palaga - 27 Dec 2004 21:36 GMT
ok, thanks !

> Ahh I see. Generally you can load and save at any time. Even read from the
> registry when you need to read a value. If you have a lot of user
[quoted text clipped - 37 lines]
>> >> (same question would apply for calling serialize() and deserialize() )
>> >> thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.