I have figured out how to produce a user defined combo box within a propertygrid after some serious time. But the problem I have now is that instead of me entering hard coded values, I wish to get the values from a database (not a problem there), but I am having a problem in defining the combo content varable.
See code examples and hopefully it will become clear:
The following code is my hard coded combo values, obviously produces a varible containing "Bob", "John" and "Dave"
The following code is just a snippet of code that opens the database and get values. But I dont know how to loop through the table values (myReader) and add each value to a variable in the same format as code snippet above.
Cheers
Simon
See code examples and hopefully it will become clear:
The following code is my hard coded combo values, obviously produces a varible containing "Bob", "John" and "Dave"
Code:
Dim _States As String() = New String() {"Bob", "John", "Dave"}
The following code is just a snippet of code that opens the database and get values. But I dont know how to loop through the table values (myReader) and add each value to a variable in the same format as code snippet above.
Code:
Private Sub buildArea()
[COLOR=DarkRed]comboValues[/color] = New String() {}
Dim myConn As New OleDb.OleDbConnection("Provider=sqloledb;Data Source=(local);initial catalog=test;user id=admin;password=lidds")
Dim myCmd As New OleDb.OleDbCommand("SELECT * from areaTbl", myConn)
myConn.Open()
Dim myReader As OleDb.OleDbDataReader = myCmd.ExecuteReader()
Do While myReader.Read
[COLOR=DarkRed] This is where I am having the problem need
to loop through table values and somehow append comboValues
variable to same format as previous code[/COLOR]
Loop
myConn.Close()
End Sub
Cheers
Simon