Articles in this section
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

 

Showing form on double click in WinForms Grid

Figure 1: Showing Form on double-click

Samples:

C#: OpenFormInDblClick

VB: OpenFormInDblClick

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied