我正在开发一个 VB6 应用程序,我想发送一个类型作为参考并将其存储在另一种形式中。这可能吗?
发送没问题,我就用ByRef
关键字:
public Sub SetStopToEdit(ByRef currentStop As StopType)
但是当我尝试使用 Set 存储currentStop
在接收模块中时,运行程序时出现“需要对象”错误:
Private stopToEdit As StopTypeModule.StopType
' ... Lots of code
Set stopToEdit = currentStop
StopType
在模块(不是类模块)中定义如下:
Public Type StopType
MachineName As String
StartDate As Date
StartTime As String
Duration As Double
End Type
是否可以存储发送的引用或者我必须StopType
变成一个类?
仅设置局部变量即可:
stopToEdit = currentStop
stopToEdit
稍后更改时,更改在发送到的变量中不可见SetStopToEdit
。