473,770 Members | 1,954 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB2005 return editable array/structure?

4 New Member
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
Aug 23 '07 #1
1 1365
kirilogan22
4 New Member
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
6614
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 oci8 routines. The output resides in a structure defined within the sub-routine. Now I want this structure to be returned to main program so that I can assing output data to variables in main program and do some manipulation. Can any body guide...
5
2652
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. Dim ptColor As Color 4. End Structure
7
3841
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 is approx 60 forms with so approx 180 to 240 classes The back end was and remains S!L Server 2000
1
1775
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 to files as a large byte array. This is a series of Lectures where there is a capacity for 8 instructors with up to 8 lectures each. So a parameters file made from glctInstTable is 2,232 bytes. The 64 lectures, for the above, each consist of...
0
942
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 be able access the data whenever required and save any changes. Since it isn't a lot of data, I don't want the overhead of a dbms. With VB2005 (express) I created a class that consisted essentially of one record of the previous structure. Now I...
1
1571
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 be able access the data whenever required and save any changes. Since it isn't a lot of data, I don't want the overhead of a dbms. With VB2005 (express) I created a class that consisted essentially of one record of the previous structure. Now I...
92
3354
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; I created the equivalent in VB:
5
1456
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 0 to 255 but the high byte can only be 0 to 4. What's happening is that quite often a zero high byte becomes 255 after it goes through shared memory. The bytes are in groups of 24 bytes.
13
3523
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 get the "UserName" of a connection. How is it possible? plz hlp thnk u
0
9453
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10254
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8929
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.