Category / Section
How to open a form on MouseDoubleClick event in WinFormsGridGroupingControl?
1 min read
MouseDoubleClick event
To open a form on double-click, you can use the MouseDoubleClick event of the TableControl. In the event handler, you can implement the form opening operations.
C#
//Hook the event to open a form on a mouse double-click event. this.gridGroupingControl1.TableControl.MouseDoubleClick += TableControl_MouseDoubleClick; void TableControl_MouseDoubleClick(object sender, MouseEventArgs e) { Form form2 = new Form(); //Set caption for the form form2.Text = "New Form"; form2.Show(); form2.Focus(); form2.BringToFront(); }
VB
'Hook the event to open a form on a mouse double click event. Private Me.gridGroupingControl1.TableControl.MouseDoubleClick += AddressOf TableControl_MouseDoubleClick Private Sub TableControl_MouseDoubleClick(ByVal sender As Object, ByVal e As MouseEventArgs) Dim form2 As New Form() 'Set caption for the form. form2.Text = "New Form" form2.Show() form2.Focus() form2.BringToFront() End Sub
Figure 1: Showing Form on double-click
Samples: