Hi,
I have a combobox and a datagridview bound to a table in my database.The combobox shows the "ID"s and i want to display a complete row in the gridview based on a selected id in the combobox.

Recommended Answers

you need to make sure your combobox is accessable (make it public) and do something like

int id = Convert.ToInt32(combBox.text);

string sqlStatement = "SELECT columnName1, columnName2, columnName3 FROM TableName WHERE IDColumn = ' + id + '";

Hope this helps

Jump to Post

All 3 Replies

you need to make sure your combobox is accessable (make it public) and do something like

int id = Convert.ToInt32(combBox.text);

string sqlStatement = "SELECT columnName1, columnName2, columnName3 FROM TableName WHERE IDColumn = ' + id + '";

Hope this helps

Ok thanks i got an idea of how to do it...can you help me a bit further.. i have got one row in my gridview based on the combobox selection..how to keep adding to the rows on continuous combobox selections ?

Have a look at this link you'll be able to find info on how to do pretty much anything from MSDN forums.

Hope it helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.