Visual Basic question

APTYP

Sonny, I Watched the Vault Bein' Built!
OK, here it is: can I call objects Image1 through 40 using a loop? An example, please?





[img align=center" src="//redrival.com/aptyp/ftclogo-t.gif]
 
In all my VB programming I have never done that so I'm not completely positive but I think you can do that. I'm trying to get a hold of one of my friends (who is a programming guru in just about every language I have ever heard of, the bastard) and ask him. You may see him OL, his name is Ripkill, if so ask him. He will surely know the answer.
 
>OK, here it is: can I call objects Image1 through 40 using a
>loop? An example, please?

You mean you have 40 Image controls?

You should do an array of controls, then you can work thru all of them using a for...next loop

Dim byCount as Byte

For byCount = 0 to UBound(Image()) 'Don't know if this exactly works with controls. UBound gets the highest value of an array. You can use "For byCount = 0 to 40", though.
Image(byCount).MyProperty = MyValue
Next byCount

This should work without problems.



[p align=center]
MatuX
Co-Leader and Chief Programmer on
http://clanfusionn.hypermart.net/tmslogo1.gif
[font size=1]GFX by Smackrazor
[font size=2]http://www.modsquad.f2s.com[/p]
 
BTW, to create a control's array you have to

Add a control to the form.
Name it.
Then copy it to that same form and it will ask you if you want to make a control's array. Obviously, no! I mean, yes...



[p align=center]
MatuX
Co-Leader and Chief Programmer on
http://clanfusionn.hypermart.net/tmslogo1.gif
[font size=1]GFX by Smackrazor
[font size=2]http://www.modsquad.f2s.com[/p]
 
Just a couple of minutes ago I read a book and found that yes, I need to create a control array. Thank you for your tips!





[img align=center" src="//redrival.com/aptyp/ftclogo-t.gif]
 
Back
Top