Okay first of the variables that I have: they are all structures
ex. ALL.vehicles.ca rs has some functions and and variables/arrays
ex. ALL.vehicles.bo ats is the same structure as .cars
ex. ALL.vehicles.ca rs.price(array)
ALL.vehicles.bo ats 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.ca rs
elseif GlobalString = "boats" then
return ALL.vehicles.bo ats
--and so on
end if
I want to be able to do this
public sub BLAH BLAH( asfsdf)
GlobalString="C ars"
'other codes
VariableChooser .Price(0)=1000
'other codes
end sub
Since global is set to Cars VariableChooser will return ALL.vehicles.ca rs and I want that line that I wrote in BLAHBLAH to be able to change ALL.vehicles.ca rs.Price(0) to 1000. And if GlobalString="b oats" then I want that ALL.vehicles.bo ats.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
ex. ALL.vehicles.ca rs has some functions and and variables/arrays
ex. ALL.vehicles.bo ats is the same structure as .cars
ex. ALL.vehicles.ca rs.price(array)
ALL.vehicles.bo ats 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.ca rs
elseif GlobalString = "boats" then
return ALL.vehicles.bo ats
--and so on
end if
I want to be able to do this
public sub BLAH BLAH( asfsdf)
GlobalString="C ars"
'other codes
VariableChooser .Price(0)=1000
'other codes
end sub
Since global is set to Cars VariableChooser will return ALL.vehicles.ca rs and I want that line that I wrote in BLAHBLAH to be able to change ALL.vehicles.ca rs.Price(0) to 1000. And if GlobalString="b oats" then I want that ALL.vehicles.bo ats.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
Comment