String as Variable name ?

CdRsKuLL

Active member
Joined
Sep 26, 2006
Messages
40
Programming Experience
Beginner
Hi, I've done some searching but can't get my head around how I would use a string as a variable name. So something like....

Dim a as string = "something here"
Dim b as string = "a"

msgbox var

This should output "something here"

Thanks,

Steve
 
Not possible.
A variable is just that, a dynamic memory allocation that can point to variable data, so you can assign this or that to it. If you have multiple variables you can use conditional code to determine which variable to use. As a collection of variables you have the array/list arrangements that can be indexed by position, and dictionary collections that can use a string as key.
If you explain what you are trying to do more specific advice can be given.
 
Hi, thanks for the quick reply.

I'm writing a media frontend but have also coded in plugins. I would like the plugins to have access to variables within the main program by a simple function. The plugin sends the variable name and it's returned with it's value. I could write a select case for all the different variables maybe but thought that they might be a quicker way of doing it.

Thanks,

Steve
 
If you require looking up values by a string key, using a dictionary should be the solution.
 
Back
Top