Convert Variant Type 9 (Object) to String

The following code gives

Var cb As Variant = self.callBack
Var type As Integer = cb.Type

type = 9 with callBack being a property that holds a reference to another window.
For display , type is converted to string by type.ToString.

How do I get cb as a string value for display?

If cb is a reference to a window, what do you expect to display? Basically, you can’t convert a window reference to a string, at least not a string that contains anything recognizable.

You can use introspection to show the class name.

Im learning OOP and try to get my head around objects, properties and methods. It is out of curiosity that I would like to see the value of cb, assuming that it is a pointer to some block of memory that holds the window instance.

An object could be shown as a JSON representation of such object as deep as the language allows. That’s called serialization of an object. XOJO has not methods for such thing yet natively, and methods in XOJO can’t be serializable.

Kem played with such subject in the past:

1 Like

@Rick_Araujo, Thank you for the link and info!

I also found @Jeremy_Cowgar’s Webinar as a good primer.

1 Like