Link to home
Create AccountLog in
Avatar of TRAININGBSC
TRAININGBSCFlag for Spain

asked on

Saving form settings in external in VB.net

I have a form in my application that has some input controls like text boxes and radio buttons. I would like to be able to save the status of that window in an external file and be able to load it after wards. I know how to work with the My.Settings namespace and I tried a couple of things but it requires a lot of code to specify if you want the app to save the settings upon closure or not.

I heard about working with XML files and .INI files but I would like to have a little idea of how would that work in the code.

Any ideas?

Thanks in advance!
Avatar of i_am_robin_hood
i_am_robin_hood

You can loop througth children Controls of your Form, and than througth children controls of this contols(recursion).., than using Reflection you an access all propereties of Contols. Save their name and type to xml, names and values of all properties. To Resotre them you should loop backwards.

Or you can try Serialize Form(if it is serializable).
ASKER CERTIFIED SOLUTION
Avatar of i_am_robin_hood
i_am_robin_hood

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.