On Apr 12, 11:28 am, "Armin Zingler" <az.nos...@freenet.dewrote:
"The Mad Ape" <chief...@gmail.comschrieb
Hi
Whenever I open a form and want to check for an existence of the
form I use the following code:
Dim frm As Form
For Each frm In Me.MdiParent.MdiChildren
If TypeOf frm Is Form17 Then
frm.Close()
End If
Next
However when this same code is placed in a module it does not work
as 'Me' throws an error:
Me is not valid withing a module.
How do I overcome this?
Get rid of the Module. Move the code into the MDIParent. If you need to
call it from outside, put it into a Public Sub. If there can be only one
instance of Form17, declare a variable of that type, so you won't have
to search for it.
Armin
I did what you said but now when I call it as follows:
AddHandler tabLblPulp.Click, AddressOf GetStandVol 'where GetStandVol
is the name of the sub and tabLblPulp is a programmatcially created
label that I wish to put code behind the click event.
I am getting and error that GetStandVol is not declared, even though I
declared it as a public sub in the parent form. What is up with that?
Thanks