Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21842

[RESOLVED] Trouble with For loop

$
0
0
Hi

I have a form with 431 labels on it. It´s an array. Now I have an array of words each not longer than 12 letters. I start by randomizing my array and then put the words in my labels. What I want is like this - three of the same and so on. Like This

Keli
Keli
keli
Nonni
Nonni
Nonni

And so on my code is:

Private Sub Command1_Click()
RandomizeArray

Rem empty the labels
For X = 0 To 431
Label1(X).Caption = ""
Next

Rem put words in the labels
For X = 0 To 431 Step 12

lengd = Len(nafn(r))
For i = 1 To lengd

Label1(X + i - 1).Caption = Mid(nafn(r), i, 1)

Next

Next

End Sub

This gives my the same word because r is constant. I think I need another For Loop but I´m stuggling. Any help plesae.

Keli

Viewing all articles
Browse latest Browse all 21842

Trending Articles