|
-
Jun 16th, 2004, 02:57 PM
#1
Thread Starter
Addicted Member
Usercontrol & Indexing (strange)
I have a usercontrol that I use that is in a control array. The strange thing is that when I load the usercontrols and put them where they are supposed to be, there is still an instance of the 0 indexed control that is in the same location on the form at design time. I know that it is the same index because the captions are the same. To check and make sure that the right indexes were being used I labeled the usercontrols with their indexes. Can anyone help me?
-
Jun 16th, 2004, 03:04 PM
#2
-
Jun 16th, 2004, 03:06 PM
#3
Thread Starter
Addicted Member
It is strange because it is like I have two controls with index of 0. I can only control one of them. The one at design time just stays there but it is like it creates an instance of it and then I can control it with index of 0. Does that clear it up?
-
Jun 16th, 2004, 03:13 PM
#4
post the code you are using to load the controls
-
Jun 16th, 2004, 03:16 PM
#5
Thread Starter
Addicted Member
Code:
TotalControl = 1
For i = 1 To 100
Load myControl(i)
myControl(i).Visible = True
TotalControl = TotalControl + 1
Next i
So that will give me a total of 101.
-
Jun 16th, 2004, 03:29 PM
#6
You can save processing power a little:
VB Code:
For i = 1 To 100
Load myControl(i)
myControl(i).Visible = True
Next i
TotalControl = i
It should return the correct value to i
-
Jun 16th, 2004, 04:04 PM
#7
myControl.Count will return the total number anytime you need to access this number... so you actually don't even need a seperate variable at all
but this still does not solve your problem i guess... what if you set the visible property to false at design time (since your setting it to true at run time when loading them dynamically) perhaps that will fix it?
-
Jun 17th, 2004, 06:21 AM
#8
Thread Starter
Addicted Member
Thanks for the suggestion. I do set to false already at design time. I think it is something funky with the usercontrol.
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
|