EventHandler?

A

able

Dear friends

In form1 I have declared an EventHandler like this:

Public Event DoeIt As EventHandler

Form2 is than loaded as modal from form1. From form2 I have to pass an
AddHandler to EventHandler "DoeIt". To do so the coding is like this:

Dim myForm1 as New Form1
AddHandler myForm1.DoeIt, AdressOf Me.This_DoeIt

Due to form1 already is open, the statement "Dim myForm1 as New Form1"
causes some trouble. Is it in this case a solution to refere to the "DoeIt"
not declaring a new form1?
 
J

Jonathan Allen

Dim myForm1 as New Form1
AddHandler myForm1.DoeIt, AdressOf Me.This_DoeIt

You need to pass a reference to the copy of Form1 that is already loaded.
Example...

In Form1

DIm x as new form2
x.setForm (me)

In Form2

Sub setForm( something as Form1)
AddHandler something.DoeIt, AdressOf Me.This_DoeIt
End Sub
 

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