Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / converting a string to a variable

Author
Message
PeterLewis
21
Years of Service
User Offline
Joined: 27th Sep 2003
Location: South Africa
Posted: 26th Oct 2003 13:44
is there anyway of converting a string into a variable

I have a string called win$(1) and it has a value which for instance will be "bz5" ( Allways 3 letters)

I have a variable of bz5 which has a value of 250.

I want to say line1win = win$(1) (which is converted to the variable)

Is there any way ?

The program must do multiple of these and that is why I do not want to use the long method of if's and then's. the are 50 options of the three letters and 25 lines to do. This would give me 1000 lines of code ????

Thanks in advance
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Oct 2003 14:53
No, you can't do it.

A way to get the same effect is to have an array of strings holding these 'variables' as a name, and another array holding the value for the variable
X_MEN
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 26th Oct 2003 20:16
dim win$(1)
win$(1)="123"
line1win=val(win$(1))
print line1win

You cant do it if you try

Login to post a reply

Server time is: 2024-11-25 14:32:01
Your offset time is: 2024-11-25 14:32:01