DatabaseField: Can I instantiate it myself?

I have a CSV class and I want it to mimic a RecordSet as closely as possible just for ease of use. I originally figured I’d just instantiate a DatabaseField and use the Field() and IdxField() functions as accessors, just like a RecordSet. However, I found while I can instantiate a DatabaseField, I can not assign a value to it. As soon as I do, I get a Bus 10 error. i.e. In a new console project, in the Run event:

Dim d As New DatabaseField
d.StringValue = "xyz"

I am assuming that there is some hidden voodoo inside the C code of the database plugins that is not really exposed to Xojo which doesn’t allow me to instantiate this class from Xojo?

I get the same in a GUI.

You can’t just use a Variant directly?

I was originally thinking of that, but then thought that DatabaseField would be more of a match as it would take care of some things such as getting a date value directly from a string inserted as a standard SQL Date/Time. I guess a variant would be a good compromise.

Or your own, similar class.

This.

Create your own CSVClass and use the same method/property names as DatabaseField. Then it will look the same.

Why not just implement the database field interface ?

There are all kinds of solutions. I was just trying to reuse existing code so I didn’t have to reinvent the wheel.

So is it the case that DatabaseField can not be instantiated from within Xojo?

No
Its basically read only UNLESS you’re a plugin but then they literally create a new instance
Subclass one
You can’t create one and assign to it in any useful fashion