Hi, i've been working with class modules a lot more in a recent program and have come across a problem. It isn't really a problem but there's got to be a better way of doing it. This is what i'm doing:
So if you run this code you will have an error on the line which says "b = a". That doesn't work (obviously) but now you know what my problem is. How can i copy all of the information from one class module to another? Sure, in this case i could easily do it like this:Code:'This is in the form module Private Sub Form_Load() Dim a As New cTime, b As New cTime Set a = New cTime Set b = New cTime a.Init 35, 20, 4 b = a 'This makes an error "Object doesn't support this property or method" End Sub 'This is inside class module "cTime" Private mSeconds, mMinutes, mHours Public Property Get Seconds() Seconds = mSeconds End Property Public Property Let Seconds(NewV) mSeconds = NewV End Property Public Property Get Minutes() Minutes = mMinutes End Property Public Property Let Minutes(NewV) mMinutes = NewV End Property Public Property Get Hours() Hours = mHours End Property Public Property Let Hours(NewV) mHours = NewV End Property Public Sub Init(Secs, Mins, Hrs) mSeconds = Secs mMinutes = Mins mHours = Hrs End Sub
but that becomes very impractical when you have 10+ properties.Code:b.Init a.Seconds, a.Minutes, a.Hours


Reply With Quote
