|
-
Mar 9th, 2000, 05:53 PM
#1
Thread Starter
New Member
I need to be able to pass the name of an object into a variable and the use
the variable to alter that objects properties...
eg.
Variable1 = ActMod1.Name
Variable1.value = 15
variable1.ID = 0012
etc.
Does anyone know how to do this???
-
Mar 9th, 2000, 09:03 PM
#2
New Member
Classes, classes, classes...
I believe the best way to do what you want to do is to create a class for your object (assuming this is possible in your situation). You can then declare a variable as your new class, which essentially creates a new instance of your object. You can then use that variable name to assign and retreive properties, methods, whatever.
If you have never done this before, it's not that hard. You just add a class module to yuor project, create your class (you may have to look up how to do this - but it's easy enough), and then it will appear in the pop-up list as one of the available choices when you declare a variable.
Hope this helps!
JFDman
-
Mar 9th, 2000, 10:16 PM
#3
Hyperactive Member
Here's an example without classes:
Code:
Private Sub Text1_LostFocus()
Call ValidateText(Text1)
End Sub
Private Sub ValidateText(cControl as Textbox) 'or as Control
If Len(cControl.Text) > 10 then
cControl.Text = Left(cControl.Text, 8)
End If
End Sub
This is only a quick example.
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
|