Creating application settings at runtime?
-
Is there a way to create application settings at runtime? So that I can save the locations of each controls on the form. Thanks in advance.
I'm not sure if you can. What you can do however is create a setting as a List<T> where T is a built in type or a class/struct of your own and add and remove to/from that list. See my article here[^] for examples.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) -
Is there a way to create application settings at runtime? So that I can save the locations of each controls on the form. Thanks in advance.
Take a look at this[^]. Following the instructions will enable you to save locations, sizes etc. for any control.
Sokka93 wrote:
Is there a way to create application settings at runtime
AFAIK there is no easy way to do this at run-time. However if you follow the link above, it will allow you to do the same thing. Good luck! :)
Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
Is there a way to create application settings at runtime? So that I can save the locations of each controls on the form. Thanks in advance.
What you could do is create a new registry key Name the new key "Your program settings". RegistryKey ProgSettings = Registry.CurrentUser.OpenSubKey("Software,true); ProgSettings.CreateSubKey("Your Program settings"); ProgSettings.Close(); Now you can add Sring Identifiers and values. RegistryKey ProgSettings = Registry.CurrentUser.OpenSubKey("Software\\Your Program settings",true) ProgSettings.SetValue("Setting Name",value) //store settings string settings = ProgSettings.GetValue("Setting Name",false);// retreave settings ProgSettings.DeleteValue("Setting Name",Setting Value); Besure to close the registry key when you are done to avoid conflicts with other parts of your program that may write to the registry. Many comercial software applications use these methods. Code Project has many examples about Writing and reading to the registry. This is much easyer the modifying the appconfig.xml file that is used when you create settings. Hope this helps GOD bless Regards
-
What you could do is create a new registry key Name the new key "Your program settings". RegistryKey ProgSettings = Registry.CurrentUser.OpenSubKey("Software,true); ProgSettings.CreateSubKey("Your Program settings"); ProgSettings.Close(); Now you can add Sring Identifiers and values. RegistryKey ProgSettings = Registry.CurrentUser.OpenSubKey("Software\\Your Program settings",true) ProgSettings.SetValue("Setting Name",value) //store settings string settings = ProgSettings.GetValue("Setting Name",false);// retreave settings ProgSettings.DeleteValue("Setting Name",Setting Value); Besure to close the registry key when you are done to avoid conflicts with other parts of your program that may write to the registry. Many comercial software applications use these methods. Code Project has many examples about Writing and reading to the registry. This is much easyer the modifying the appconfig.xml file that is used when you create settings. Hope this helps GOD bless Regards
What you could do is create a new registry key Name the new key "Your program settings". RegistryKey ProgSettings = Registry.CurrentUser.OpenSubKey("Software,true); ProgSettings.CreateSubKey("Your Program settings"); ProgSettings.Close(); Now you can add Sring Identifiers and values. RegistryKey ProgSettings = Registry.CurrentUser.OpenSubKey("Software\\Your Program settings",true) ProgSettings.SetValue("Setting Name",value) //store settings string settings = ProgSettings.GetValue("Setting Name",false);// retreave settings ProgSettings.DeleteValue("Setting Name",Setting Value); Besure to close the registry key when you are done to avoid conflicts with other parts of your program that may write to the registry. Many comercial software applications use these methods. Code Project has many examples about Writing and reading to the registry. This is much easyer the modifying the appconfig.xml file that is used when you create settings. Hope this helps GOD bless Regards
-
What you could do is create a new registry key Name the new key "Your program settings". RegistryKey ProgSettings = Registry.CurrentUser.OpenSubKey("Software,true); ProgSettings.CreateSubKey("Your Program settings"); ProgSettings.Close(); Now you can add Sring Identifiers and values. RegistryKey ProgSettings = Registry.CurrentUser.OpenSubKey("Software\\Your Program settings",true) ProgSettings.SetValue("Setting Name",value) //store settings string settings = ProgSettings.GetValue("Setting Name",false);// retreave settings ProgSettings.DeleteValue("Setting Name",Setting Value); Besure to close the registry key when you are done to avoid conflicts with other parts of your program that may write to the registry. Many comercial software applications use these methods. Code Project has many examples about Writing and reading to the registry. This is much easyer the modifying the appconfig.xml file that is used when you create settings. Hope this helps GOD bless Regards