During the work of a new Coretech SCCM Manager GUI in WPF, i ran in to some problems with My.Settings.
I have used My.Settings for all settings in the Utility, and are using my own structures for the combo-box value and others.
The problem is that i could not create a setting, that contained my own structure instead of a system data type.
I simply could not select it in the list:
I tried to use the browse function, but no luck.
I have searched the net for ages, trying to find a solution, but never found one.
This problem can occur in both Windows Forms And Windows Presentation Foundation (WPF) projects
After while i figured out how to do it:
1. Open the Settings.Designer.vb file
2. If you are working in an WPF project, you cannot select the code file behind the GUI for the settings. Therefore you have to go to the Project folder and open the file itself in \ProjectFolder\My Project\
3. Now copy one of the properties already in there:
_ Public Property OSDEnabled() As String Get Return CType(Me("OSDEnabled"),String) End Get Set Me("OSDEnabled") = value End Set End Property
4. Change the new copy to your custom datatype, in my case it was my “Definitions” structure class
_ Public Property OSDCollection() As Definitions Get Return CType(Me("OSDCollection"), Definitions) End Get Set(ByVal value As Definitions) Me("OSDCollection") = Value End Set End Property
5. Now it should be working, but the GUI in Visual Studio still does not show the new data type, but luckily this can be fixed!
6. Open Settings.Settings file in the same folder
7. Copy one of the old settings and change it to the new data type (just like you did before).
Copy one of the other settings:
Change it to your new type:
8. Now everything should be working and you data type has appeared in the dropdown list in Visual Studio.
I hope this small article is helpful.
P.S. I was working in Visual Studio 2008, but i think it is possible to do the same in 2005.