Avatar of mainrotor
mainrotor

asked on 

I Need help preventing my button click event from being raised twice on my VB.Net application

Hi Experts,
I need help preventing my button click event from being raised twice on my VB.Net application.

I use a base class and an interface on my VB.Net application.

I override the button_click event on my base class, so that the button_click event fires on my interface.  However, by doing this the button_click event on my interface executes twice.  I need help preventing this from happening.  How can I do this?  

I have included the button_click event of my base and interface classes below.

Base Class button_click event
overidable Sub btnPrint_Click(ByVal Sender AS System.object, ByVal e As system.EventArgs) Handles btnPrint.click
'...some code goes here
End Sub

Open in new window


interface class button_click event
This is the code that fires twice.
overrides Sub btnPrint_Click(Sender As object, e as Event Args) Handles btnPrint.click
   If (X = 0) Then
          MsgBox("Test")
   Else
          MyBase.btnPrint_Click(sender, e)
   End If
End Sub

Open in new window

Visual Basic.NET.NET ProgrammingVisual Basic Classic

Avatar of undefined
Last Comment
mainrotor

8/22/2022 - Mon