Double Click Event not fire

G

Guest

I have a vb .net program

Public Class Testing
Inherits System.Windows.Forms.Form

<STAThread()> Shared Sub Main()
System.Windows.Forms.Application.Run(New HelloWorld())
End Sub

Public Sub New()

MyBase.New()
Me.Text = "Testing"
Me.AutoScale = False
Me.StartPosition = FormStartPosition.Manual
Me.MaximizeBox = False
Me.FormBorderStyle = FormBorderStyle.FixedToolWindow

End Sub

Private Sub Form1_DoubleClick(sender As Object, ByVal e As System.EventArgs) Handles MyBase.DoubleClick
do_something()
End Sub


The do_something() is not raised when I double click the form ...

Any Idea, Thank You
 
R

Rami Saad

Hi, You are trying to handle an event from the base class, and that might be
the cause of your problem most probably. You can handle events raised on the
current form.

--
Rami Saad
Microsoft GTSC Developer support for Middle East


GroupMan said:
I have a vb .net program

Public Class Testing
Inherits System.Windows.Forms.Form

<STAThread()> Shared Sub Main()
System.Windows.Forms.Application.Run(New HelloWorld())
End Sub

Public Sub New()

MyBase.New()
Me.Text = "Testing"
Me.AutoScale = False
Me.StartPosition = FormStartPosition.Manual
Me.MaximizeBox = False
Me.FormBorderStyle = FormBorderStyle.FixedToolWindow

End Sub

Private Sub Form1_DoubleClick(sender As Object, ByVal e As
System.EventArgs) Handles MyBase.DoubleClick
 
H

Herfried K. Wagner [MVP]

* "Rami Saad said:
Hi, You are trying to handle an event from the base class, and that might be
the cause of your problem most probably. You can handle events raised on the
current form.

Mhm... The designer adds the handlers for the base class's events too.
 
G

Guest

Override the OnDoubleClick method. It is the prefered way of handling events in inherited forms...

regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top