I've defined several UDTs, but need a way to detect the data type, when an instance is passed to a lower level function.
I could just add a string type field to each UDT, but I was hoping for a less kludgy way to do this in VB.

fso declaration and file opening/writing/closing code omitted for brevity.

The reason I need to detect each UDT type separately, is because when writing these vars to a file, they require some special formatting, for syntax reasons in the target application.


Private Type dblParam
Val As Double
name As String
desc As String
End Type

sub myFunc(fso as object)

Dim udtDouble as dblParam

udtDouble.val = 1.1
udtDouble.name="Frequency"
udtDouble.desc="clock frequency"

WriteParams(fso, udtDouble)

end sub



sub WriteParams(fso as object, Instance as variant)

Select Case (VarType(Instance))

Case dblParam <-- THIS DOESN'T COMPILE :-)
Call WriteDouble(fso, Instance)

'Case lngParam
Call WriteLong(fso, Instance)

'Case strParam
Call WriteString(fso, Instance)

'Case lstParam
Call WriteList(fso, Instance)

End Select

End sub