• Welcome to PlanetSquires Forums.
 

Shared Variable length strings

Started by Petrus Vorster, February 13, 2023, 09:17:36 AM

Previous topic - Next topic

Petrus Vorster

Hi All

How do I create a shared variable length string in WINFBE?
I need to create a constantly changing list of about 40 items , but I will need to be able to access that list from different functions.

I also need to create a variable length array from that list and make the array accessible to the other functions and update the array as the list changes.

A few Pointers will be most helpful.

Regards,

Peter

-Regards
Peter

Paul Squires

#1
A shared (global) string can be created by using DIM SHARED at the top of your source file outside of any sub or function.

dim shared myString as string

You would do the same for an array:

redim shared myArray() as string




Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Petrus Vorster

I see what i did.

I was at the right place, but i tried to add the string content there as well.

That would be a problem.
Moved that bit to a function and now it works.


Regards

Peter
-Regards
Peter

Paul Squires

No problem. I also edited my post because I think that dynamic shared arrays need to be created using "REDIM SHARED" rather than "DIM SHARED". I am not on my Windows computer right now but the FB online help seems to suggest that REDIM SHAREDis what you need to use.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Petrus Vorster

Thank you so much Paul.

You cannot imagine how chuffed I am over this little predictive text function that now works like a charm.

This forum and its members are just remarkable.

Regards,
Peter
-Regards
Peter