I'm working on a VB6 application and I would like to send a Type as a reference and store it in another form. Is this possible?
Sending it is no problem, I just use the ByRef keyword:
public Sub SetStopToEdit(ByRef currentStop As StopType)
But when I try to use Set to store currentStop
in the recieving module I get the "Object required" error when running the program:
Private stopToEdit As StopTypeModule.StopType
' ... Lots of code
Set stopToEdit = currentStop
StopType is defined as follows in a Module (not a class module):
Public Type StopType
MachineName As String
StartDate As Date
StartTime As String
Duration As Double
End Type
Is it possible to store the sent reference or do I have to turn StopType into an class?
While just setting a local variable works:
stopToEdit = currentStop
When stopToEdit is later changed the change is not visible in the variable sent to SetStopToEdit
.