© Microsoft Corporation. All rights reserved.

VB6 Initialize a VB6 Class
  Public Function Init _
   (Optional ByVal AppName As Variant, _
   Optional ByVal Mode As csModes = csModeRegistry)
   If IsMissing(AppName) Then
      msAppName = App.EXEName
   Else
      msAppName = Trim$(AppName)
   End If
   'default to the app's .exe path
   msININame = App.Path & "\" & msAppName & ".ini"
   SaveMode = Mode
End Function

Listing 1 | You can't initialize a VB6 class when you instantiate it, so a common technique is to call an Init method once you create the object. You can use two optional parameters to set the app's name and initial mode: INI or Registry.