|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
WithEventI 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 --------------- 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 --------------- > > > >
Whats's the problem using a enum like this?
Is It Possible to Retrieve a List of Declared Variables? Converted a solution to VS2005 and it is complaining: Variable 'PF2' is used before it has been assi setting datagrid column widths in code? Detect Concurrent Running Instances Inheritance and function issue FileDownload with WebBrowser Control - disable the Save? write Override methods in Code Editor VS2005 How do I maintain paragraph numbers into a new word document |
|||||||||||||||||||||||