A simple way to do this is to add a class that inherits Collection(Of T) for your type and mark it with SettingsSerializeAs attribute. For example like this:
Imports System.Configuration
<SettingsSerializeAs(SettingsSerializeAs.Xml)>
Public Class Somethings
Inherits System.Collections.ObjectModel.Collection(Of Something)
End Class
Public Class Something
Public Property Test As Integer
End Class
Then you open the settings page and add a new setting. Let's Name it "Some". Set Scope to User.
In Type combobox select Browse... You can't select the type from your own assembly, but in Selected Type textbox below you can specify the namespace qualified type name, for example: WindowsApplication1.Somethings
For Value paste in valid xml that describes the empty collection (this will prevent the setting returning Nothing):
You can only select a Type for a setting, not an array of a Type. The above solution uses a specific collection type to hold all the objects you want to store in that setting.
SettingsSerializeAs.Xml attribute tells the settings provider to serialize the collection of Something objects to xml.
So something is my type here and somethings is the array? And i need to move my type into something?
what is a "in Selected Type textbox below you can specify the namespace qualified type name" I try typing myappname.somethings but said type not defined
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.