I have a problem, how can i get value from cell of datagridview
----------------------------------
id | p/w | post |
----------------------------------
1 | 1234 | A |
----------------------------------
2 | 4567 | S |
----------------------------------
3 | 6789 | A |
----------------------------------
I want to get 3 into the textbox,how to do that? Can anyone give some example coding? than you~
Selecting a single cell You can select cells the same way you select rows – by setting their IsSelected property to true : C# VB.NET.
Text = Convert. ToString(frm. DataGridView1[0, row]. Value); Textbox2.
The DataGridView control provides a customizable table for displaying data. The DataGridView class allows customization of cells, rows, columns, and borders through the use of properties such as DefaultCellStyle, ColumnHeadersDefaultCellStyle, CellBorderStyle, and GridColor.
The line would be as shown below:
Dim x As Integer
x = dgvName.Rows(yourRowIndex).Cells(yourColumnIndex).Value
It is working for me
MsgBox(DataGridView1.CurrentRow.Cells(0).Value.ToString)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With