|
-
Oct 10th, 2002, 01:40 PM
#1
Thread Starter
Hyperactive Member
Events in ActiveX controls
Will an ActiveX control wait for any code in an event handler to finish executing before processing the code after the RaiseEvent call?
Example:
VB Code:
'In the ActiveX control...
MsgBox "1"
RaiseEvent Call("2")
MsgBox "3"
'...rest of code
'In the calling application
Public Sub MyControl_Call(Msg As String)
MsgBox Msg
End Sub
Will I get 1,2,3?
And I, for one, welcome our new insect overlords. I'd like to remind them as a trusted TV personality, I can be helpful in rounding up others to toil in their underground sugar caves.
-
Oct 10th, 2002, 01:47 PM
#2
Frenzied Member
Run it and see. I don't think it will stop and wait.
Don't anthropomorphize computers -- they hate it
-
Oct 10th, 2002, 01:54 PM
#3
Thread Starter
Hyperactive Member
*throws his hands in the air*
Awwww!!! Do I have to do EVERYTHING myself?!?!
I decided to just move the code after that RaiseEvent to a public method, and let the user decide if that code should be executed or not by calling the method..makes it easier on me
And I, for one, welcome our new insect overlords. I'd like to remind them as a trusted TV personality, I can be helpful in rounding up others to toil in their underground sugar caves.
-
Oct 10th, 2002, 02:21 PM
#4
I believe it does wait. In other ActiveX objects it does (dll/exe). Because you can get a return value from the event and can decide what to do from there. That is kind of how the Cancel parameter works for things like the Unload Event of a form.
VB Code:
'in axtivex
Public Event Closing(Cancel As Boolean)
dim bCancel as boolean
RaiseEvent Closing(bCancel)
If bCancel=True then Exit Sub
'user didn't cancel in the event so continue
'in the event
Public Sub Obj_Closing(Cancel As Boolean)
'this gets returned to the object
Cancel=True
End Sub
-
Oct 10th, 2002, 02:23 PM
#5
it should wait on a message box at least since it will display modally to the control...
-
Oct 10th, 2002, 02:27 PM
#6
Thread Starter
Hyperactive Member
Ah yes the Unload and QueryUnload events..that makes sense now that I think of it.
I was pretty sure if I had a message box displaying it would wait, but it was highly unlikely we would have a message box in the event handler in question.
Anyways, thanks for the feedback as always.
And I, for one, welcome our new insect overlords. I'd like to remind them as a trusted TV personality, I can be helpful in rounding up others to toil in their underground sugar caves.
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
|