PDA

View Full Version : [VB6] Do Without Loop



Ashleys165
01-21-2012, 04:22 PM
This is a bit more complicated then you may think, I mean do without loop? Just add do. Buuuut in this case I can not find this and I need this to work... sooo...


Thank you for the help... I don't want TNT changing anything on neopets so I am ridding of this code being public.

Sorry for the mess, I attempted tabbing... I don't like it... hehe :rolleyes:

Miguel
01-21-2012, 05:40 PM
Loop Until mynumber = 10

I think should be


Do Until mynumber = 10

Hexx
01-21-2012, 06:28 PM
If you indent your code properly it would be much easier to debug things like this.

Soredavide
01-21-2012, 07:08 PM
Sorry it is hard to read this code (indent when you are in a loop, the indention shows what peice of code goes within which part of the loop) , but it looks like you are mixing the types of loop statements.
When using Do until, you don't need a second loop statement.


Private Sub Command1_Click()
Dim x As Integer
x = 0
Do
Text1.Text = x
x = x + 1
Loop Until x = 10
End Sub

A do while statement requires the loop


Private Sub Command1_Click()
Dim x As Integer
x = 0
Do While x < 10
Text1.Text = x
x = x + 1
Loop
End Sub

It does not appear that you are incrementing your number inside the loop, I am also not sure why you are dimensiong variables in a loop.

Ashleys165
01-21-2012, 07:09 PM
If you indent your code properly it would be much easier to debug things like this.
I learned from Youtube.... they don't really teach how to indent.