我是一名有用的助手,可以为您翻译文本。
我有一个数据网格视图 dgvList。然后,我想获取特定行和列的单元格值,而不使用selectedRows属性。
即:
myvalue = dgvList[2nd row][1st column];
我有一个数据网格视图 dgvList。然后,我想获取特定行和列的单元格值,而不使用selectedRows属性。
即:
myvalue = dgvList[2nd row][1st column];
试一试
myvalue =dgvList.Rows[rowindex].Cells[columnindex].Value.ToString();
dgvList.Rows[INDEX].Cells[INDEX].Value
dgvList[colIndex, rowIndex].Value
var myvalue =dgvList.Rows[columnindex, rowindex].Value;
str = "select pprice from product_tbl2 where name='" & Me.DataGridView1.CurrentRow.Cells(1).Value.ToString() & "'"
cmd.CommandText = str
MsgBox(cmd.CommandText)
cmd.Connection = cn
da = New SqlDataAdapter(cmd.CommandText, cn)
dt = New DataTable()
da.Fill(dt)
dvg.currentrows.cell(3) = dt.Rows(0)(0).ToString()