|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
breaking a do while loop early
if i wanted to break out of the do loop early
Compiler Error Message: BC30081: 'If' must end with a matching 'End If'. Line 135: if temp < 0 then Line 136: loop Line 137: end if notice the loop breaks the if, does anyone know a way around this? |
|
#2
|
|||
|
|||
|
Code:
If Temp < 0 Then
Exit Do
End If
__________________
Programmer's Corner |
|
#3
|
|||
|
|||
|
Thanks for the response, but i don't want to exit the loop completely. I need to actually just continue on to the next iteration. I just did the rest of the loop in an if statement, where if temp <0 then rest of loop. For some reason it won't let you loop to the next one in the if statement.
|
|
#4
|
|||
|
|||
|
Code:
Dim ctr As Control
For Each ctr In Me.Controls
If TypeOf ctr Is TextBox Then
' do something here
End If
Next
in that example if the condition is met then you do something. if not then the if statement if false and all of the code inside it is ignored. the loop still continues though. other then that i don't really understand your question. |
|
#5
|
|||
|
|||
|
Thank you for the responses, sorry if i was not clear, the problem is solved pretty much.
I have this do while x != something blah if y < x then blah end if loop I wanted to just do a if y < x then continue end if so that it would just start the next iteration rather than having to nest the rest of the loop statement in an if statement. Thanks again for your responses. |
|
#6
|
|||
|
|||
|
sounds like laziness to me
you could try using GoTo but the if statement is generally how i think most would do it. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > breaking a do while loop early |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|