Home All Groups Group Topic Archive Search About
Author
27 Jan 2006 9:02 PM
John\
I have an EXE file that calls a DLL.
I would like the DLL to RaiseEvent on the EXE, I have pasted sample code for
the DLL and EXE

My problem is that the Class doesn't seem to be able to Raise the Event on
my executable...  Any ideas, or errors you see?
Thanks in advance,
J.

-------- START OF CLASS ----------------------
' The class project is called ClassTest
Public Class Class1

    Public Event TestRaiseEvent()

    Public Sub Test()

        RaiseEvent TestRaiseEvent()

    End Sub

End Clas

-------- END OF CLASS --------------


--------- EXE CODE ---------------
Public clsTest as New ClassTest.Class1
Public WithEvents TestDLL As ClassTest.Class1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

    clsTest.Test()


End Sub

Public Sub Test_DLL_Test() Handles TestDLL.TestRaiseEvent

    MsgBox("This is a test of the Raise Event Function....")

End Sub

--------- OF OF EXE ---------------

Author
27 Jan 2006 9:09 PM
Marina Levit [MVP]
You are raising the event on object clsTest, but handling the event of
object TestDLL.  You need to handle the event of the object actually raising
the event - which in this case is clsTest.

Btw, TestDLL doesn't look like it is ever getting instantiated - maybe you
are doing that elsewhere in a code segment you are not showing here?
Show quoteHide quote
"John\" <j*@jonkar.ca> wrote in message
news:e0FDMU4IGHA.208@tk2msftngp13.phx.gbl...
>
> I have an EXE file that calls a DLL.
> I would like the DLL to RaiseEvent on the EXE, I have pasted sample code
> for the DLL and EXE
>
> My problem is that the Class doesn't seem to be able to Raise the Event on
> my executable...  Any ideas, or errors you see?
> Thanks in advance,
> J.
>
> -------- START OF CLASS ----------------------
> ' The class project is called ClassTest
> Public Class Class1
>
>    Public Event TestRaiseEvent()
>
>    Public Sub Test()
>
>        RaiseEvent TestRaiseEvent()
>
>    End Sub
>
> End Clas
>
> -------- END OF CLASS --------------
>
>
> --------- EXE CODE ---------------
> Public clsTest as New ClassTest.Class1
> Public WithEvents TestDLL As ClassTest.Class1
>
> Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>
>    clsTest.Test()
>
>
> End Sub
>
> Public Sub Test_DLL_Test() Handles TestDLL.TestRaiseEvent
>
>    MsgBox("This is a test of the Raise Event Function....")
>
> End Sub
>
> --------- OF OF EXE ---------------
>
>
>
>