473,324 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

VB2005 return editable array/structure?

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
Aug 23 '07 #1
1 1337
nevermind found a way using delegates
Aug 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Neo | last post by:
Dear All, I want to know how a subroutine should return an array of values to the main program. From the main program, I call a sub-routine 'get_sql' which then fetches data from oracle db using...
5
by: Sam | last post by:
Hi All I have couple of question regarding property of a class and structures. **** ---- Here is my class and structure ---- ***** 1. Public Structure MyPoint 2. Dim p As Point 3. ...
7
by: guy | last post by:
Has anyone any experience of the conversion wizard for VB6 to VB2005? if so how good is it? also how does it handle database related conversions i.e is ADO converted to ADO.NET etc. the project...
1
by: Galen Somerville | last post by:
And yet another VB6 to VB2005 problem. All helpful suggestions appreciated. As you can see in the code below, my structures use fixed length strings and known array sizes. Consequently I can save...
0
by: MikeCS | last post by:
Problem: I wanted to implement what I did in VB6 where I would use a global structure and dimension an array of structures then the program could load data into it at start up. Global routines would...
1
by: MikeCS | last post by:
Problem: I wanted to implement what I did in VB6 where I would use a global structure and dimension an array of structures then the program could load data into it at start up. Global routines would...
92
by: =?Utf-8?B?bW9iaWxlbW9iaWxl?= | last post by:
I'm trying to load this structure for a call to DeviceIoControl: typedef struct _NDISUIO_QUERY_OID { NDIS_OID Oid; PTCHAR ptcDeviceName; UCHAR Data; } NDISUIO_QUERY_OID, *PNDISUIO_QUERY_OID; ...
5
by: Galen Somerville | last post by:
My VB2005 program has a DataReciever thread that recieves data from an Activex VB6 thread. The data comes from a USB device that delivers 10 bit data in a series of bytes. So the low byte can be...
13
by: Javad | last post by:
Hello I know that I should get the information of windows internet connections by using "rasapi32.dll" library, and I also have some sample codes, but I can't make them work. My exact need is to...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.