PDA

View Full Version : Newbies to VB....need help !!!


fleechy
06-16-02, 03:19
Hie,

I'm new to VB and I'm having a problem regrading delay and label properties.

My code:

(current backcolor = vbblue)

Label1.BackColor = vbRed
For i = 0 To 10000000
Next i
Label1.BackColor = vbblue

I have one label and I wish to set the back color from blue to red then delay for a while before switching it back to blue.

I can't get this done as the end result just went to blue without going to red first.

Please help. I can't find anything on the book.

Another questions is regrading different label name properties. Let say I have 10 Label, as such from Label1..Label2.....Label10

Is there a way where I can access different label usng the for loop statement.

Eg: For x =1 to 10
Label (x) = 1
Next i

I can't get this statement working. Please help.

Thanks a million....!!!
Issac

gjallenuk
06-18-02, 13:32
Try putting a doevents in between the for i = 0 to and the next. This yeilds control and should allow you to display the colour you want. If you create a control array you can loop through and set them all with a few lines of code. If you need any more mail me

rnealejr
06-19-02, 23:32
Using the timer control is a perfect solution here. As for you referencing the labels - make your labels a control array. You can also loop through the controls on your form and check to see if it is a label but in this case the control array is a better solution.

Good luck.

fleechy
06-20-02, 03:51
Hi,
Thanks for all your help, I got the codes working and are learning to use the control array for my labels. Thanks again for your kind reply and coaching..!

Issac