Hello folks - I have a question for you:

I have a Class (class1), that inherits a Windows.Form. On a button click, it passes a reference of itself to another class (class2). The aim is to handle all of the form control events in class2, thus freeing up coding space in class1.

Class 2 looks like this:

Public Class Class2

Dim cl1 As Class1
Dim iCode As Integer

Public SetData(ByVal iCode As Integer, ByRef cl1 As Class1)

Me.iCode = iCode
Me.cl1 = Class1

'Add Button Handlers
AddHandler Class1.btn1.Click, AddressOf btn1_Click
AddHandler Class1.btn2.Click, AddressOf btn2_Click
AddHandler Class1.btn3.Click, AddressOf btn3_Click
AddHandler Class1.btn4.Click, AddressOf btn4_Click


End Sub

Private Sub btn1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub

Private Sub btn2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub

Private Sub btn3_Click(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub

Private Sub btn4_Click(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub

End Class

There are 3 buttons in Class1 that create a new instance of Class2 and call the SetData passing a different value for iCode but the same created instance of Class1. The problem I have is if you click btn3 for example, after the message box is displayed, it's handler is automatically called again, sometimes up to 4 times without me doing anything! I've experimented pressing the 4 buttons in Class1 and pressing any of the buttons handled in Class2 and sometimes the associated message box is displayed just the once (which is what should be happening), and on other occassions it can be displayed multiple times.

Can someone elighten me as to what's wrong with my code?

Thanks in advance