简体   繁体   中英

How to get id from database that's equal DataGridView1 selected row id cell value in c#

How to get id from database that's equal DataGridView1 selected row id cell value in c#?

I have this code in vb.net, and now I have to convert it to c#.

my code

DataGridView1.Item(0, DataGridView1.CurrentRow.Index).Value

Although it's a duplicate from Getting the first cell from selected row from DataGridView in C#

getting the first cell value from selected row would be:

dataGridView1.SelectedRows[0].Cells[0].Value.ToString();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM