learn
asked on
Make a new event for a form?
How to make a new event for a form something like what can be done in an ActiveX control: declare an event, raiseevent.....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
To Sicilian:
Thank you.
Instesd a class I need a form which has got a "paper" to draw something :-)
Thank you.
Instesd a class I need a form which has got a "paper" to draw something :-)
ASKER
To AnswerTheMan:
Your answer looks like what I need :-), but
1. You mens we can not create an event and list it in the event list of the form so that a user can code somthing into it in design time?
2. Why
Unload Form2
Set Form2 = Nothing
Form2 was loaded in your code?
Your answer looks like what I need :-), but
1. You mens we can not create an event and list it in the event list of the form so that a user can code somthing into it in design time?
2. Why
Unload Form2
Set Form2 = Nothing
Form2 was loaded in your code?
1. you have not noticed well.
look at Form1 Up menu and you'll see
that there is an Object called
'frmTest' there with all other controls. click on it, and on the right
list you'll get it's public events
which are the OPS event.
2. that is just a precaution. after you
obtain a Refernce to Form2 by frmTest
, you don't need FOrm2 anymore.
in this example it may seems not in
place, but in other cases it is
recomended. making a habit to do it
(won't raise any error here), is a
good for preventing future bugs.
3. don't forget to unload and set nothing 'frmTest' on Form1_Unload event.
look at Form1 Up menu and you'll see
that there is an Object called
'frmTest' there with all other controls. click on it, and on the right
list you'll get it's public events
which are the OPS event.
2. that is just a precaution. after you
obtain a Refernce to Form2 by frmTest
, you don't need FOrm2 anymore.
in this example it may seems not in
place, but in other cases it is
recomended. making a habit to do it
(won't raise any error here), is a
good for preventing future bugs.
3. don't forget to unload and set nothing 'frmTest' on Form1_Unload event.
ASKER
Hi AnswerTheMan,
That is great! Thank you very much for your excellent answer and comment.
That is great! Thank you very much for your excellent answer and comment.
you welcome
Couldn't you just declare your event in a class, Implement it in any form you want to use it in by declaring the class module with the WithEvents keyword, raise it appropriately and write code to the event?
Perhaps you have no way of raising it appropriately? Maybe if you told us what the new event you want to implement is?
Sicilian