|
-
Jan 28th, 2001, 02:07 PM
#1
Thread Starter
Junior Member
I want to add a costum event in a built in object in VB
Like a form or another objects, how can i do this?
suppose i have an object in
a project in vb such as form. this form has
some events like: Load, MouseMove, Keypress and lablabla...,
now i want to add an event to these events.
how can i ?
THANX in advance
ps: i'm interested in to know farther about this subject, plz inform me if there are documents relared to this subject.
-
Feb 11th, 2001, 03:20 AM
#2
Addicted Member
Here Is It::
Event OnAdd(byval Result as long) 'The Arg Is Optional
Dim Res as long
Private Sub Form_Load()
AddNums 10,10
end sub
private sub AddNums(a as long,b as long)
Res=a+b
RaiseEvent OnAdd(Res)
end sub
private sub Form_OnAdd(byval Result as long)
msgbox Result
end sub
__________
If You Want To Know More(Like Properties ) EMail me.
-
Feb 11th, 2001, 03:06 PM
#3
Member
I don't understand, in this code example the source and the destination of the message are the same. The form is sending a message to itself. Why should you do something like this?
If there is an external event (outside of the form) that must fire an event on the form you must create an extra class that can fire events. Look up the WithEvents keyword and the Event statement in the VB help files.
-
Feb 11th, 2001, 08:03 PM
#4
Addicted Member
You Can Have Events In The Class Modules Or The User Controls You Create. And Those Events Can Be Handled In Your Forms.
-
Feb 12th, 2001, 03:03 AM
#5
Member
Yes, that was I mean. You need a event source (control or another class) and an event destination such as a VB form. No offence but if you create sample code as you did, it is must clearer if I create a completly working code sample that can be with cut and paste directly injto VB. Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|