Hi Rico,
Before you can Raise an event in a class, you have to instantiate the
class. If the class (a form in this instance) is already running,
you'll need to gain access to that instance.
Even If you changed your code to :
Dim RunFrm as New form1()
RunFrm.form1.ActivateEvent()
By this code, you're creating a new instance of Form1 (which you
mentioned is already running.) What you probably want to do instead, is
to access the instance of the Form1(running) and activate the event in
that instance.
The way is to access the instance of the already running form is to
create a shared instance of Form 1 that is accessible from your
"RunFrm".
Try this way :
This code goes in Form1 :
#Region " Global variables "
' Variables which store an instance of Launched form and of This form.
Private varMyNewForm As RunFrm
Public Shared thisForm As Form1
#End Region
In the Sub that Launches the New form (RunFrm)
'Create a variable to store this instance of Form 1
thisForm = Me
varMyNewForm = New RunFrm()
varMyNewForm.Show()
Me.Hide()
Now we're coding in RunFrm : (Remember "thisForm" refers to the already
open, but hidden instance of Form 1)
thisForm.ActivateEvent()
That should do it.
Don't forget to again show your main form in the Closing event of
RunFrm.
HTH,
Regards,
Cerebrus.