使用VB.Net,
在我的应用程序,现在用的DataGridView,当我点击特定行,这行的值应出现在文本框中。
In my application, am using datagridview, when i clicking the particular row, that rows value should be appear in the textbox.
所以,code应该受到的DataGrid3_CellMouseDoubleClick事件。
So the code should be come under the DataGrid3_CellMouseDoubleClick Event.
如何dispaly在文本框中一个行价值。
How to dispaly a rows value in the textbox.
例如
3行指 - 3行中的值应在3个文本框中显示
3 rows means - 3 rows values should display in 3 textbox.
VB6 code
Private Sub datagrid1_DblClick()
textbox1 = datagrid1.SelectedItem.SubItems(1)
textbox2 = datagrid1.SelectedItem.SubItems(2)
textbox3 = datagrid1.SelectedItem.SubItems(3)
End Sub
如何通过获取数据网格行值写一个code在vb.net。
How to write a code in vb.net by getting datagrid row values.
需要VB.Net样品code帮助
Need VB.Net sample code Help
试试这个 - >
Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
Dim i As Integer
i = DataGridView1.CurrentRow.Index
TextBox1.Text = DataGridView1.Item(0, i).Value
TextBox2.Text = DataGridView1.Item(1, i).Value
TextBox3.Text = DataGridView1.Item(2, i).Value
TextBox4.Text = DataGridView1.Item(3, i).Value
End Sub
在这里,我是所选行的rowIndex位置为 DataGridView1.Item(0,I),
和数量是细胞指数。
Here i is the RowIndex of the selected row for DataGridView1.Item(0, i),
and the number is the cell index.