1

I know how to add the items during design time but how do you add the items through code. I want to fill the combo box in the datagrid with the results of an SQL query?

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by parkeyparker
0

I know how to add the items during design time but how do you add the items through code. I want to fill the combo box in the datagrid with the results of an SQL query?

you're going to have to create an array to store the results from the sql query.

In the method where the sql query is executed populate the array using a while loop. (while there is data in the query).

then in your method where you want to populate the combo box. Just run a for loop that takes an item from the array and adds it to the combo box.

you can find all the code to do this online. Hope this helps

0

That what I need is the code. It is not the same as a combo box since the combo box is in the datagridview. First I have to add the row then popuplate the column of the row that contains the combo box.

0

I am going to be working on this in a project that I am working on soon. As soon as I know I will let you know... I will probably be working on it a little tonight so will try and have a reply for you soon!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.