I have a problem, how can i get value from cell of datagridview
----------------------------------
id | p/w | post |
------------------------
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)
In you want to know the data from de selected row, you can try this snippet code:
DataGridView1.SelectedRows.Item(0).Cells(1).Value
It is working for me
MsgBox(DataGridView1.CurrentRow.Cells(0).Value.ToString)
The line would be as shown below:
Dim x As Integer
x = dgvName.Rows(yourRowIndex).Cells(yourColumnIndex).Value
To get the value of cell, use the following syntax,
datagridviewName(columnFirst, rowSecond).value
But the intellisense and MSDN documentation is wrongly saying rowFirst, colSecond
approach...