?
Solved

How to use Events??

Posted on 1998-10-09
2
Medium Priority
?
169 Views
Last Modified: 2010-04-30
I am a total newbie to VB Programming, so please bare with me....  I have a program, and when a particular thing occurs, I want an event to be Raised(so that another program knows to do something).  How do I raise an event(that isn't something like onclick().)  Now, how can I have another vb program listen for this event, and carry out some actions if this event is actually raised?
Thanks, hope this makes sense.
0
Comment
Question by:sbishop
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Expert Comment

by:Veroland
ID: 1439035
It sounds like you want to use something like DDE. Dynamic Data Exchange
0
 
LVL 9

Accepted Solution

by:
Dalin earned 300 total points
ID: 1439036
sbishop
A event is araised by a component in your (such as a control) program to indicate something happed to it (like click), so you can add code in the event to do what you like when the event happens.  This is because you don't know or don't care what's going on inside the control until the event is happening. You don't not raise an event (so to speek) in your program, because you know exactly what is going on in your program.

What you talking about another program, it is a different story. The 2nd program may not care what is going on in the first, only when the "event" occur.  So what you can do is to make the first program as a component of the 2nd in the form of ActiveX (Control, Dll, EXE).  In that case you can raise an event.
To raise a event, you first tell VB that your control(say) has event using the WithEvent
Example: Private WithEvents myControl As Someobject

then you defined what event:
Public Event ChangeText()

and finally when it's time to raise it, using:RaiseEvent ChangeText


It is a little  complecated. So you may look at the DDE, it is much simpler. But DDE is a deminishing technology and it is not as reliable.

Regards
Dalin

 



0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question