Different forms raising the same event

G

Guest

Hi,

I have one form where I want to open several other forms from, withevents.

Ideally I want to have the same event raised, but I don't know if this can
be done.

For example, in the main form ("MainForm") I can have in the declarations
section:

Private WithEvents OtherForm as Form Form_Form1

and then in Form1 I can raise an event. In MainForm, any events are
available in the vb window, and all is fine.

If I use:

Private WithEvents OtherForm as Form

and then open the form with:

Set OtherForm As New Form1

I can't raise an event in MainForm from Form1, and the event isn't available
in the vb window.

Is it possible to have multiple forms raising the same event within my first
form? I know I could do this by multiple declarations, but is this the only
way?

Thanks in advance.


swas
 
G

Guest

I'm not sure I follow 100%, but if I did then simply declare your sub routine
as public and then you can reference it elsewhere.
 

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