Forum Discussion

aholloway's avatar
aholloway
New Contributor
15 years ago

Class_Initalize not called when a new instance of class is created in VBscript

The Class_Initalize constructor is not being called when a new instance of class is created in VBscript.  Here's some code from my project:



Class TRMTestCases

  private objAppClass, objWinClass, objTRMClass

  private strFeature



  Private Sub Class_Initalize

      Set objAppClass = GetApplicationClassInstance

      Set objWinClass = GetWinControlsClassInstance

      Set objTRMClass = GetTRMClassInstance    

      strFeature = "TRM"

      MsgBox("I'm in Class_Initalize")  

  End Sub



....other code

End Class

...

Dim myTRMTestCasesInstance

Function GetTRMTestCasesInstance   

  If (Not IsObject(myTRMTestCasesInstance)) Then

    Set myTRMTestCasesInstance = New TRMTestCases

  End If

  Set GetTRMTestCasesInstance = myTRMTestCasesInstance

  MSgBox("I'm in Get....Instance")

End Function



Any ideas on why the constructor's not being called?

1 Reply

  • aholloway's avatar
    aholloway
    New Contributor
    Nevermind.  I figured it out.  Typo in the declaration.I had Class_Initalize instead of Class_Initialize