Okay first of the variables that I have: they are all structures
ex. ALL.vehicles.cars has some functions and and variables/arrays
ex. ALL.vehicles.boats is the same structure as .cars
ex. ALL.vehicles.cars.price(array)
ALL.vehicles.boats will also have price as an array
I have multiple buttons on a Windows Application form, each button corresponds to one of these structures variable, since I need to do a lot of calculations with many different functions. I want to be able to have a function that selects the appropriate variable for me. So I can pretty much just pass the function over to the other functions/calculations/manipulation.
ex. public variable accessible by all sub/function named GlobalString
when button 1 is clicked it changes GlobalString to "Cars"
current function VariableChooser() as StructureName
in the structure it says
if GlobalString = "Cars" then
return ALL.vehicles.cars
elseif GlobalString = "boats" then
return ALL.vehicles.boats
--and so on
end if
I want to be able to do this
public sub BLAH BLAH( asfsdf)
GlobalString="Cars"
'other codes
VariableChooser.Price(0)=1000
'other codes
end sub
Since global is set to Cars VariableChooser will return ALL.vehicles.cars and I want that line that I wrote in BLAHBLAH to be able to change ALL.vehicles.cars.Price(0) to 1000. And if GlobalString="boats" then I want that ALL.vehicles.boats.Price(0) to 1000 (assuming price(0) is declared).
I tried it the say it the say I wrote VariableChooser() above, and all it does is change it to the VariableChooser() and not the "original array" pretty much it is getting returned by value. I want VariableChooser to be returned by reference/pointer.
How would I go about doing that? If you know please post some sample code on how I would create pointer and use them if I must (and could?) or by reference or any other method.
I need this because the code would get ENORMOUS if I had to do those if statements for every method/button.
Thank you in advance