|
-
Jul 28th, 2000, 12:11 PM
#1
Thread Starter
Hyperactive Member
Hi, is there a way of dynamically indicating what the variable names are in a type. Say I have:
Type Employee
FName as string
MName as string
LName as string
Addr1 as string
(and so on)
End Type
Say these names match fields in a database table. If I later add a new field in the table (Email, for example), I want to add to the Employee type: Email as string
Is there a way to do this without opening the code again and installing updates? I know when you read a recordset, you can dynamically determine the field names.
Thanks in advance.
-
Jul 28th, 2000, 12:18 PM
#2
transcendental analytic
You could create a dynamic array of strings, but that means you can't have those names
Code:
Type Employee
a() as string
End type
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 31st, 2000, 02:21 PM
#3
Thread Starter
Hyperactive Member
If I did that, is there a way of dynamically setting the variable type (I'm thinking no), or at least a way of deallocating memory from variables that aren't needed -- say I make 12 string variables but only need 8 initially.
Thanks.
Wade
-
Jul 31st, 2000, 02:57 PM
#4
transcendental analytic
You can redimension your string array
Code:
DIm b as Employee
redim b.a(8)
'Then later you could do:
Redim preserve b.a(12)
'If you want to deallocate:
Erase b.a
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 31st, 2000, 02:59 PM
#5
Thread Starter
Hyperactive Member
It's not perfect, but it's progress. Thanks 
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
|