开发者

mouse click event on row in Data Grid in C#

How to handle mouse click on a row in Datagrid in C#

for eg if i m populating a table from my database in a data grid and when i select a row .i should be able to go to a different page and display the contents of that row in text开发者_StackOverflow中文版 boxes .is it possible to do that in c#


You can handle SelectionChanged event of DataGridView and use DataGridView1.SelectedRows collection to get reference of selected row(s).

if(DataGridView1.SelectedRows.Count!=0)
{
  str = DataGridView1.SelectedRows[0].Cells[0].Value;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜