Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perform something like "macro substitution" in a class

Status
Not open for further replies.

ExtraD

Programmer
Jul 6, 2005
41
0
0
NL
Hi,

I have the following question:

I created a class called “unit” within this class I have a member called “type” from the type
Public Type FCCUnitType
a As Double
Bus As Double
BusH As Double
B As Double
c As Double
d As Double
f As Double
End Type

Now when I do unit.type.a I get an amount that I have stored earlier. I select a,b,c,… based on a VAR called UnitType with a value (a,b,c,..)

Now instead of making a select case
Select case UnitType
Case “a”
Value = unit.type.a
Case “b”
Value = unit.type.b
……

I would like something like value = unit.type.&UnitType like you can do in FoxPro.

Is there a solution to do something like this?

thanx

 
use named constand for unit type (integers 1,2,3) and use array.
like this:
(caseA defined as 1, caseB 2 etc)

Value = unit.type[caseA]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top