Solved

OCX Raise Event

Posted on 2004-03-26
2
408 Views
Last Modified: 2013-11-13
I was wondering, How do you raise an event. Such as how the winsock Control has subs that get called. Winsock1_DataArrival.

How would I add a sub called "StartChange" to my OCX that the user can enter their code into and will be triggered.



-Brian
0
Comment
Question by:BrianGEFF719
2 Comments
 
LVL 27

Accepted Solution

by:
Dabas earned 500 total points
ID: 10691039
Hi BrianGEFF719:
You declare your event at the top of your class

Public Event MyEvent1(Parameter1 As String, Parameter2 As Integer, ...)

When you want an event to occur within your program, you Raise the event

Public Sub MyProc
      RaiseEvent "hello", 5

Inside your calling module, you have to declare a variable as "With Events"

Dim WithEvents oMyClass as cMyClass

Dabas
0
 
LVL 19

Author Comment

by:BrianGEFF719
ID: 10691133
Thanks, let me try it out and get back to you.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
This video teaches viewers about errors in exception handling.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

808 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