If I have a datagridview that is bound to a dataset which comes from a MSSQL database, how can I have the datagridview display only one row of data from the dataset rather than all of the rows?
Specifically, the first column is a combobox which is bound to the items in the dataset. When the datagridview loads, it displays as many rows as there are items in the dataset. I need to display only one row, allow the user to select an item from the combobox and enter through the rest of the columns in the row, and then add another row after that.

Recommended Answers

All 2 Replies

Don't bounds the combobox to the dataset. by a loop read the table and add the value of the datafield to the combobox at the time of loading of the form. Then add a row->choose item from combobox and go through the other cells. No need to load data everytime when you have been added a new row.

A DataGridViewRow has a Visible property which you could manipulate.
Read this.

Be a part of the DaniWeb community

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