Propertygrid and dropdownlist from Database
-
Hi, I am trying to write an app where the users would have to define for instance company departments where employer would work. These departments are store in my database. In the user interface, where the user has to enter the employers, I am trying to use the propertygrid. For the department I want to use a dropdownlist filled with the options from the database. I have got a typeconverter that converts a sting into a dropdownlist, but this is only hardcoded. I am not able to pass a string created from my database into the typeconverte. The converter looks like this Public Class DropDownConv Inherits StringConverter 'Override the GetStandardValuesSupported method to indicate that this object supports a standard set of values. 'Override the GetStandardValues method and return a StandardValuesCollection filled with our custom list. Dim _States As String() = New String() {"Alabama", "Alaska", _ "Arizona", "Arkansas", _ "California", "Colorado", "Connecticut", "Delaware", _ "Florida", "Georgia", _ "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", _ "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", _ "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", _ "Nebraska", "Nevada", "New Hampshire", _ "New Jersey", "New Mexico", _ "New York", "North Carolina", "North Dakota", _ "Ohio", "Oklahoma", _ "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", _ "South Dakota", "Tennessee", "Texas", "Utah", _ "Vermont", "Virginia", _ "Washington", "West Virginia", "Wisconsin", "Wyoming"} Public Overloads Overrides Function GetStandardValuesSupported( _ ByVal context As ITypeDescriptorContext) As Boolean Return True End Function Public Overloads Overrides Function _ GetStandardValues(ByVal context As _ System.ComponentModel.ITypeDescriptorContext) _ As System.ComponentModel.TypeConverter.StandardValuesCollection Return New StandardValuesCollection(_States) End Function 'Finally override the GetStandardValuesExclusive method. When set to false, it changes the dropdown list to Combo box (editable). If set to true, then its a simple list box (Read only). Public Overloads Overrides Function _ GetStandardValuesExclusive(ByVal context _ As System.ComponentModel.ITypeDescriptorContext) _ As Boolean Return True End Function End Class Can you give me some ideas on how to continue? Thanks David J