Handling Events in a VBScript Class
Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance
I can handle events fired by an object as follows:
set objTest=WScript.CreateObject("TheObject.TheFunction","objTest_")
Sub objTest_TheEvent
'The event handler code.
End Sub
The above works quite nicely.
I want to do the following:
Class WrapperClass
Sub Class_Initialize
set objTest=WScript.CreateObject("TheObject.TheFunction","objTest_")
End Sub
Sub objTest_TheEvent
'The event handler code.
End Sub
End Class
When I try the second way, the event handler is never called. If I
move it outside the class, it DOES get called, surprisingly enough,
even though the object is declared and initialized inside the class.
Is there any way I can modify this so that the event handler is a
class member?
Thanks,
--Vorpal
.
Relevant Pages
- Re: Odd Button Behaviour
... Private Sub btnCancelSend_Click(ByVal sender As System.Object, ... The event handler isn't hooked up to the corresponding event properly. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ... (microsoft.public.dotnet.framework.windowsforms) - Re: Possible to ignore base class event handler?
... Form_Report_Shifts contains an event handler for a button named ... Private Sub cmd_Show_Click(ByVal sender As System.Object, ... twice. ... Protected Overridable Sub btn_OpenChild_Click(ByVal sender As ... (microsoft.public.dotnet.languages.vb) - Re: Possible to ignore base class event handler?
... Form_Report_Shifts contains an event handler for a button named ... Private Sub cmd_Show_Click(ByVal sender As System.Object, ... Inherits System.Windows.Forms.Form ... Protected Overridable Sub btn_OpenChild_Click(ByVal sender As ... (microsoft.public.dotnet.languages.vb) - Re: WHERE IS *.ASPX.DESIGNER.VB FILES???????
... You should not have to manually create any event handler sub under any circumstance. ... If it is not the correct event handler (VS uses the default event of any control, so it doesn't always guess correctly), just pull down the event dropdown listbox in the top, right of the code editor and select the correct event. ... > All of my aspx files were created with the seperate code file option. ... (microsoft.public.dotnet.general) - Re: Dynamic control and onClick event Server-side
... First create a procedure with the exact signature as an event handler ... Dim btnAdd as New Button ... Public Sub btnAddHandler(ByVal sender As System.Object, ... (microsoft.public.dotnet.framework.aspnet) |
|