loop from A to D

Ramiroapollo

New member
Joined
Jun 26, 2014
Messages
1
Programming Experience
Beginner
I have a code that loop from A to D and displays the result in a text box as the loop continues.

Dim test(0 To 3) As String

test(0) = "A"
test(1) = "B"
test(2) = "C"
test(3) = "D"

For i As Int32 = 0 To test.Length - 1
TextBox4.Text = test(i)
TextBox4.Refresh()
Me.Refresh()
Next

But the problem is that the loop only goes like A , B , C ,D
How can I make the loop so it keep going on like
A
B
C
D
AA
AB
AC ....and so on?
 
For starters you'll need to set your textbox multiline property to true (assuming you want them displayed as you've shown). You will also need to add a carriage return line feed each time you add to it. Refreshing here isn't necessary. Sounds like a class assignment so that should help you get started.
 
But the problem is that the loop only goes like A , B , C ,D
How can I make the loop so it keep going on like
A
B
C
D
AA
AB
AC ....and so on?
If you want double letters then you would probably use two nested loops, the outer loop selecting the first letter and then the inner loop selecting the second letter and combining the two. It depends exactly what you want though. You've said "and so on" like we can read your mind. Does that mean just single and double letters or triple too? What about quadruple? Is the ending fixed or can the user choose? Provide a FULL and CLEAR description of the problem because guessing is no fun.
 
Back
Top