|
-
Aug 5th, 2000, 05:57 AM
#1
That's strange. I don't get any errors like that. Here's what I did to try it out.
Start a new standard EXE project. Add one checkbox and set its index property to 0 (zero). Add a command button to the form and put the following codde in its click event:
Code:
Private Sub Command1_Click()
Dim X As Variant
Dim iCount As Integer
Set X = Check1
iCount = X.Count
Load X(iCount)
With X(iCount)
.Move .Left, X(iCount - 1).Top + .Height
.Visible = True
End With
End Sub
Now, every time you click on the CommandButton it load an other CheckBox.
Best regards
-
Aug 5th, 2000, 06:00 AM
#2
Originally posted by kedaman
The count is a property of a collection object so i guess you have to delclare x as a collection, and add your contols in it
A control array is actually equal to a control collection. You can use the For Each Next syntax on it. The difference is that it can start with any index and it doesn't have a Remove method.
-
Aug 5th, 2000, 05:28 PM
#3
transcendental analytic
Another diff is that you can't access the properties from a list, i think the contol arrays are classcollections
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.
-
Aug 7th, 2000, 09:18 AM
#4
Hyperactive Member
That works...just need to figure out what I was doing differently. Thanks Joacim!
-
Aug 7th, 2000, 09:54 AM
#5
Hyperactive Member
I realized what's different. Try using your same code but alter the Try using:
Code:
'In the Checkbox
Set X = ActiveControl
Msgbox X.Count 'Gives error 438: object doesn't support this property or method
or:
Code:
'In the command button
For each X in Controls
If X.Name = "Check1" Then
Msgbox X.Count 'Gives error 438: object doesn't support this property or method
End If
I need a modular set statement. What can I do to make the set statement dynamic?
Thanks.
-
Aug 7th, 2000, 10:12 AM
#6
Could this be of any help then?
Code:
If ActiveControl.Name = "Check1" Then
Set X = Check1
MsgBox X.Count
Else
Set X = ActiveControl
End If
-
Aug 7th, 2000, 10:25 AM
#7
Hyperactive Member
Thanks for the replies. It's close but I don't want to hard-code Check1 in the set statement. I can read "Check1" from a file or database field, so I'm trying to make this dynamic. Any other ideas?
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
|