Class assignment as String

Dim dt as new DateTime
Dim v as Variant
Dim str as String

v = dt
str = v

With the above code, the string contains the SQLDateTime format of the DateTime class.

Can I reproduce that behavior in a class of my own where:

Dim mClass as new MyClass
Dim v as Variant
Dim str as String

v = mClass
str = v

so that MyClass returns a string variable based on the contents of the class?

Implement a Operator_Convert method in your class.

1 Like

Thank you. I was familiar with the convert - from logic, but not that you could use similar syntax to convert - to

1 Like