[英]DataGridView VB.NET Displaying Data in New Window on click
Ok just a quick question. 好的只是一个简单的问题。 I have a form in VB.NET that displays information from a database in a datagrid format.
我在VB.NET中有一个表单,它以数据网格格式显示数据库中的信息。 I was curious, is there a way that you can click on a row in a datagrid and it bring up a new form?
我很好奇,有没有办法可以点击数据网格中的一行并显示一个新表格? I think it would be cool to have it to where you can select the row and it bring up a new window with textboxes that more readily display the forms information.
我认为把它放到可以选择行的位置会很酷,它会带来一个带有文本框的新窗口,可以更容易地显示表单信息。 Thanks :)
谢谢 :)
I understand that what you mean is selecting the whole row, that is, clicking on the "row header" (on the left-hand-side), in that case you should rely on the RowHeaderMouseClick Event
. 我明白你的意思是选择整行,也就是点击“行标题”(在左侧),在这种情况下你应该依赖
RowHeaderMouseClick Event
。 Sample code for DataGridView1
: DataGridView1
示例代码:
Private Sub DataGridView1_RowHeaderMouseClick(sender As Object, e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.RowHeaderMouseClick
MessageBox.Show("You have selected row No. " & e.RowIndex.ToString())
'Dim curForm As Form = New Form
'With curForm
' 'Definition of the form
' .Show()
'End With
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.