Ver Mensaje Individual
  #4 (permalink)  
Antiguo 17/11/2008, 08:29
Judgement
 
Fecha de Ingreso: noviembre-2008
Mensajes: 136
Antigüedad: 15 años, 6 meses
Puntos: 2
De acuerdo Respuesta: sentencia infinita

Cita:
Iniciado por jotaaigriegao Ver Mensaje
Infinito menos uno me parece que sigue siendo infinito...En fin, un bucle asi se logra también con

while (true)
Saludos, solo sugiero que añadas la instruccion DoEvents de lo contrario tu programa estara enciclado sin poder recibir ordenes, como para poder detener el ciclo.

Algo asi:

Código:
Dim bBandera As Boolean

Private Sub Form_Load()
    bBandera = True
End Sub

Private Sub Command1_Click()
    Dim iContador As Integer
    While bBandera
        DoEvents
        iContador = iContador + 1
        Me.Caption = iContador
        If iContador > 1000 Then iContador = 0
    Wend
End Sub

Private Sub Command2_Click()
    bBandera = False
End Sub
Espero que te sirva