|
-
July 16th, 2001, 10:56 PM
#1
vb variable macros
In clipper you could macro your variables. so a variable could be called peanut&a where "a" could be either butter or oil. peanutbutter and peanutoil would have seperate values anyone know a vb way of doing the same?
-
July 17th, 2001, 12:53 AM
#2
Re: vb variable macros
Something like this?
a = "oil"
'....
b = "peanut" & a
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
-
July 17th, 2001, 01:20 AM
#3
Re: vb variable macros
more so like
a=1
period&a = 1
a=a+1
Period&a = 2
results
period1=1
period2=2
-
July 17th, 2001, 01:43 AM
#4
Re: vb variable macros
Oh, that isn't really possible in VB, what is possible is to create an array, and address it via it's index, like this:
Dim peanut(1 to 3)
a = 1
peanut(a) = 1
a = 2
peanut(a) = 2
a = 2
peanut(a) = 3
' results in
peanut(1) = 1
peanut(2) = 2
peanut(3) = 3
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
-
July 17th, 2001, 10:17 AM
#5
Re: vb variable macros
Thanks, I'm very familier with arrays.
-
July 17th, 2001, 10:43 AM
#6
Re: vb variable macros
Or you could use a Collection class and key it thus:
Dim Peanut as Collection
set Peanut = new Collection
Peanut.Add "£3.10","Oil"
Peanut.Add "£2.50","Butter"
Debug.print Peanut("Oil")
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|