Events across VB projects 
Author Message
 Events across VB projects

Has anyone gotten events to fire from one VB project into another?

I have a Windows Forms project that has an object variable declared
WithEvents. In a separate project (library) I have a class that raises that
event.

The event is never caught by my event handler however. I have talked to a
couple other people who are having similar problems.

Is this a Beta 1 bug? Has anyone gotten this to work in general?

Thanks

Rocky

Rockford Lhotka



Sat, 31 May 2003 23:11:15 GMT  
 Events across VB projects
Rocky,

There does appear to be a problem there when using multiple projects.

I managed to work around it by either declaring the event as one of the
standard delegates.  So instead of...

    Public Event Click(sender As Object, e As System.EventArgs)

...use...

    Public Event Click As System.EventHandler

Or if custom parameters are required, declare a Delegate _outside_ the scope
of the class.  So instead of...

Public Class Something
    Public Event Click(X As Integer, Y As Integer)
End Class

...use...

Public Delegate ClickEventHandler(X As Integer, Y As Integer)
Public Class Something
    Public Event Click As ClickEventHandler
End Class

HTH.

--
David.


Quote:
> Has anyone gotten events to fire from one VB project into another?

> I have a Windows Forms project that has an object variable declared
> WithEvents. In a separate project (library) I have a class that raises
that
> event.

> The event is never caught by my event handler however. I have talked to a
> couple other people who are having similar problems.

> Is this a Beta 1 bug? Has anyone gotten this to work in general?

> Thanks

> Rocky

> Rockford Lhotka




Sun, 01 Jun 2003 02:56:04 GMT  
 Events across VB projects
Yeah, that is what worked for me.

--

--------
Russ


Quote:
> Rocky,

> There does appear to be a problem there when using multiple projects.

> I managed to work around it by either declaring the event as one of the
> standard delegates.  So instead of...

>     Public Event Click(sender As Object, e As System.EventArgs)

> ...use...

>     Public Event Click As System.EventHandler

> Or if custom parameters are required, declare a Delegate _outside_ the
scope
> of the class.  So instead of...

> Public Class Something
>     Public Event Click(X As Integer, Y As Integer)
> End Class

> ...use...

> Public Delegate ClickEventHandler(X As Integer, Y As Integer)
> Public Class Something
>     Public Event Click As ClickEventHandler
> End Class

> HTH.

> --
> David.



> > Has anyone gotten events to fire from one VB project into another?

> > I have a Windows Forms project that has an object variable declared
> > WithEvents. In a separate project (library) I have a class that raises
> that
> > event.

> > The event is never caught by my event handler however. I have talked to
a
> > couple other people who are having similar problems.

> > Is this a Beta 1 bug? Has anyone gotten this to work in general?

> > Thanks

> > Rocky

> > Rockford Lhotka




Sun, 01 Jun 2003 05:02:20 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Sharing single Module.vb across multiple projects

2. Trapping errors across whole Excel Project

3. Calling across projects -- How to?

4. How to make Project 2K WC and OLE DB work across the network

5. how to pass variables across projects?

6. how to pass variables across projects?

7. how to pass variables across projects?

8. Calling across projects: Syntax or how to?

9. Project Change event in consolidated projects

10. Capture a particular HTC event in a VB Project

11. Tricky One: Raising Events Across Applications

12. Events Across Layers

 

 
Powered by phpBB® Forum Software