String in structure

Can anybody tell me how to use a string in a structure ?
I can do integers, but can’t declare the length for a string field.

Check the examples in the LR.

someField as String*20

thanks Tim, now it works.
but still it is a strange solution, why not using the length field to put in the length of a string,
would be easier to do and understand.

thanks again

Structures are FIXED length objects.

They are NOT the same as a UDT (User Defined Type) as seen in VB.
Unless you are passing the data to an External Declare or API, define it as a CLASS instead

I agree. It is a strange syntax. But like Dave says, Structures aren’t used much in normal Xojo coding.

And if you have a very complex structure with a lot of different fields, it becomes painfully show to add or remove items from the structure in the IDE. At least that has been my experience on Windows. I converted all of my structures from our old VB6 program to classes, much easier to work with.

The time you usually need a structure is when you’re working with Declares.