On 6 maalis, 22:34, Tom Shelton
<tom_shel...@YOUKNOWTHEDRILLcomcast.net> wrote:
> > On 6 maalis, 21:58, Tom Shelton
> ><tom_shel...@YOUKNOWTHEDRILLcomcast.net> wrote:
[quoted text clipped - 109 lines]
> --
> Tom Shelton
Ok,
I made a simple test with two forms. Form_Base and Form_Child.
Form_Base has a button to open the Form_Child form. Form_Base also
has button that displays a message, "From base".
The child form overrides this method and shows "From child".
It is this "From child" message that is displayed twice for some
reason.
Here's some code:
'Form_Base
-------------------------------------------------------------
Public Class Form_Base
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
OnButtonClick()
End Sub
Protected Overridable Sub OnButtonClick()
MsgBox("From base")
End Sub
Protected Overridable Sub btn_OpenChild_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btn_OpenChild.Click
Form_Child.Show()
End Sub
End Class
-------------------------------------------------------------
'Form_Child
-------------------------------------------------------------
Public Class Form_Child
Inherits Form_Base
Protected Overrides Sub OnButtonClick()
MsgBox("From child")
End Sub
Protected Overrides Sub btn_OpenChild_Click(ByVal sender As
Object, ByVal e As System.EventArgs)
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
OnButtonClick()
End Sub
End Class
-------------------------------------------------------------
Do you see anything that is wrong here, and could result in the double
event?
Thanks.
- Christian
Tom Shelton - 06 Mar 2008 20:57 GMT
> On 6 maalis, 22:34, Tom Shelton
><tom_shel...@YOUKNOWTHEDRILLcomcast.net> wrote:
[quoted text clipped - 159 lines]
> Me.Close()
> End Sub
---- Remvoe this -------------------------------------------------------
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
> As System.EventArgs) Handles Button1.Click
> OnButtonClick()
> End Sub
------------------------------------------------------------------------
> End Class
> -------------------------------------------------------------
>
> Do you see anything that is wrong here, and could result in the double
> event?
Remove the Button1_Click sub in the derived class. That is causing the
handler to be added twice. All you need to do is override the
OnButtonClick() method.

Signature
Tom Shelton
cride83@gmail.com - 06 Mar 2008 21:05 GMT
On 6 maalis, 22:57, Tom Shelton
<tom_shel...@YOUKNOWTHEDRILLcomcast.net> wrote:
> > On 6 maalis, 22:34, Tom Shelton
> ><tom_shel...@YOUKNOWTHEDRILLcomcast.net> wrote:
[quoted text clipped - 179 lines]
> --
> Tom Shelton
Yes!
That did the trick.
Now I know how to do similar things in the future. :)
Thank you so much.
- Christian.
Tom Shelton - 06 Mar 2008 21:10 GMT
> On 6 maalis, 22:57, Tom Shelton
><tom_shel...@YOUKNOWTHEDRILLcomcast.net> wrote:
[quoted text clipped - 191 lines]
>
> - Christian.
No problem....

Signature
Tom Shelton