Search code examples
wpfvb.netapplication-settings

How to make new Application Settings in code


I'm learning how to save values to application setting on my vb.net wpf app. But is their a easy way to create new settings in code. Not just change old ones, create new ones. I'm making a note taking program for my employer who is an IT guy who take lots of notes every day. I need to save the notes somewhere. Maybe xml file isn't a good idea just let me know.

Thanks


Solution

  • I used a string listarray stored in application settings.

    In your project document you can create a setting and in the "type" option click browse. Type in System.Collections.ArrayListin the select type field. Then in the Page.Load event on your main page type the following code

    If My.Settings.setting1 Is Nothing Then
        My.Settings.setting1 = New ArrayList()
    End If
    

    And then you can use the array as normally. But I think it is a string array so only strings will work. (correct me if I'm wrong)