How to get cell value from DataGridView in VB.Net?

前端 未结 5 1397
南旧
南旧 2021-01-06 19:54

I have a problem, how can i get value from cell of datagridview

----------------------------------
id     | p/w       | post       |
------------------------         


        
5条回答
  •  粉色の甜心
    2021-01-06 20:29

    This helped me get close to what I needed and I will throw this out there for anyone else who needs it.

    If you are looking for the value in the first cell in the selected column, you can try this. (I chose the first column, since you are asking for it to return "3", but you can change the number after Cells to get whichever column you need. Remember it is zero-based.)

    This will copy the result to the clipboard: Clipboard.SetDataObject(Me.DataGridView1.CurrentRow.Cells(0).Value)

提交回复
热议问题