By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,758 Members | 1,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,758 IT Pros & Developers. It's quick & easy.

DataGridView Question

P: n/a
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

Jul 6 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
DataGridViewRow row;

DataRowView drv = (DataRowView) row.DataBoundItem;

DataRow dr = drv.Row;

MJ wrote:
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
Jul 6 '06 #2

P: n/a
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.RowIn dex].Cells[0].Value;
}

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

chanmm

"MJ" <no******@belmont.co.ukwrote in message
news:12*************@corp.supernews.com...
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

Jul 9 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.