473,396 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

WithEvent


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 ---------------


Jan 27 '06 #1
1 2538
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?
"John\" <jo@jonkar.ca> wrote in message
news:e0*************@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 ---------------

Jan 27 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jawahar Rajan | last post by:
All, I am adding a hidden field to my web from from the tool box under the HTML contorls. How ever I am not able to control in by code behind vb page. For example I add a HTMLInputHidden control...
2
by: Chua Wen Ching | last post by:
Hi there. I had 3 questions to ask. 1) Public Event ButtonClicked(MessageBoxNumber As Integer, OKButton As Boolean, CancelButton As Boolean, ExitButton As Boolean)
0
by: Steve | last post by:
I have a web site I am building in ASP.NET, and have created a web user control which has to dropdown list that get populated form a database. from the selections made in the drop downs, a datagrid...
1
by: smash2004 | last post by:
I have VS 2005 CTP. I created a page with one repeater. Inside i put a linkbutton. Usually when i put linkbutton on a page I doubleclick it in designview and event gets created in codebehind...
1
by: Kai Zhang | last post by:
I dynamically created a list of radiobuttons and I want to handle the events on all of them. However, I first cannot add withevent onto array, second, the array is really a local variable, I...
7
by: Rob Nicholson | last post by:
A thought - has VB.NET been extended to be able to handle arrays or collections with events? A problem with VB6 was that you could only declare: Private WithEvents MyControl As MyControl ...
8
by: Xero | last post by:
When my program is launched, there is a textbox on the form. When the user enters a character into the textbox (TextChanged), a second, declared textbox is added using this block of code. Dim...
0
by: The Confessor | last post by:
I have a rather sprawling application-in-progress in Visual Basic .NET 2003, and I'm using very specific naming conventions to avoid confusion and make the function of my code as self-evident as...
1
by: sapkal.manish | last post by:
Question : How can I find actual row position of DataTable in DataGridView when DataTable is sorted / My source code like this Private WithEvent dgvInwDet as new DataGridView Private...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.