U've never used VB6?
But you post in the VB 6 section...in fact, what the hell are you doing on the site you deranged Georgie
In VB6:
clsEmployee
Then in a form:VB Code:
Private Sub Class_Initialize() MsgBox "Woof" End Sub Private Sub Class_Terminate() MsgBox "Badgers!" End Sub
Does that make sense?VB Code:
Dim objSomeone As clsEmployee Set objSomeone = New clsEmployee 'This cause the initialise event to fire, and a woof msgbox. Set objSomeone = Nothing 'This causes the terminate event to fire, and a badger msgbox.
Anyways, .NET doesn't work like this.
You have new instead of Initialise.
This has more potential as you can do:VB Code:
Public Sub New() 'code here when object is created End Sub
Then in a form you can do:VB Code:
Public Class clsEmployee Public Sub New(ByVal EmployeeID As Long) 'code here to laod Employee from ID End Sub End Class
both lines do essentially the same thing.VB Code:
Dim woof As New clsEmployee(54) Dim woof As clsEmployee = New clsEmployee(67)
Woof





Reply With Quote