DataGridView Question

  • Thread starter Thread starter MJ
  • Start date Start date
M

MJ

Newbie question.

I have a DataGridView which is bound to a manually created read only
DataSet. One of the fields in the dataset is a primary key of the table. I
simply wish to know which record is selected when the user double clicks a
row as this will then open a detail view of the record in another form.

I would appreciate any advise.

MJ
 
You can do something like this

private void current_Product_ListDataGridView_CellContentClick(object
sender, DataGridViewCellEventArgs e)
{
object i;
i =
this.current_Product_ListDataGridView.Rows[current_Product_ListDataGridView.CurrentCell.RowIndex].Cells[0].Value;
}

to get the primary key to requery the row for another form.

chanmm
 
DataGridViewRow row;

DataRowView drv = (DataRowView) row.DataBoundItem;

DataRow dr = drv.Row;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top