Test Foro de elhacker.net SMF 2.1

Programación => .NET (C#, VB.NET, ASP) => Programación General => Programación Visual Basic => Mensaje iniciado por: agus0 en 13 Octubre 2009, 20:20 PM

Título: [RESUELTO] [Duda] Como puedo retrazar la ejecucion de un Comando???
Publicado por: agus0 en 13 Octubre 2009, 20:20 PM
Que tal Foreros!

Tengo una duda... hay alguna funcion o alguna manera de retrasar la ejecucion de cada comando... es decir:

Yo aprieto por ejemplo el command 1 y quiero que valla cambiando el text1 cada no se 1 segundo pero sin usar un timer poner:

Private Sub Command1_Click()
Text1.Text = "hola"
Text1.Text = "Como andas?"
Text1.Text = "Bien y vos?"
End Sub


Y poder poner todo junto con alguna instruccion que haga que se demore por que si no el texto cambiaria tan rapido que yo solo verie el "Bien y vos?"

Bueno era eso solo

Gracias!
Título: Re: [Duda] Como puedo retrazar la ejecucion de un Comando???
Publicado por: BlackZeroX en 13 Octubre 2009, 20:26 PM
Sleep()
Do while
Título: Re: [Duda] Como puedo retrazar la ejecucion de un Comando???
Publicado por: YST en 13 Octubre 2009, 20:28 PM
Mirá esto

http://support.microsoft.com/kb/212667
Título: Re: [Duda] Como puedo retrazar la ejecucion de un Comando???
Publicado por: agus0 en 13 Octubre 2009, 21:05 PM
Gracias pero... Use Sleep

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Command1_Click()
Sleep 1200
Text1.Text = "hola!"
Sleep 1233
Text1.Text = "jeje"
Sleep 1212
Text1.Text = "ÑÑÑ"
End Sub


De esa forma

y cuando aprete el command1 se demoro un tiempo y puso "ÑÑÑ"

:(

¿que hice mal?
Título: Re: [Duda] Como puedo retrazar la ejecucion de un Comando???
Publicado por: Castg! en 13 Octubre 2009, 21:53 PM
En la misma pagina de el hacker se encuantra:

http://www.elhacker.net/trucosvisual.htm (http://www.elhacker.net/trucosvisual.htm)


Citar
Ejecuta pausas durante un determinado espacio de tiempo en segundos:


Llamada: Espera(5)
Código (vb) [Seleccionar]

Sub Espera(Segundos As Single)
Dim ComienzoSeg As Single
Dim FinSeg As Single
ComienzoSeg = Timer
FinSeg = ComienzoSeg + Segundos
Do While FinSeg > Timer
DoEvents
If ComienzoSeg > Timer Then
FinSeg = FinSeg - 24 * 60 * 60
End If
Loop
End Sub


Llamada: pause segundos

Sub Pause(interval)
Dim atime
atime = Timer
Do While Timer - atime < Val(interval)
DoEvents
Loop
End Sub
Título: Re: [Duda] Como puedo retrazar la ejecucion de un Comando???
Publicado por: agus0 en 14 Octubre 2009, 00:13 AM
Cita de: castg en 13 Octubre 2009, 21:53 PM
En la misma pagina de el hacker se encuantra:

http://www.elhacker.net/trucosvisual.htm (http://www.elhacker.net/trucosvisual.htm)


Citar
Ejecuta pausas durante un determinado espacio de tiempo en segundos:


Llamada: Espera(5)
Código (vb) [Seleccionar]

Sub Espera(Segundos As Single)
Dim ComienzoSeg As Single
Dim FinSeg As Single
ComienzoSeg = Timer
FinSeg = ComienzoSeg + Segundos
Do While FinSeg > Timer
DoEvents
If ComienzoSeg > Timer Then
FinSeg = FinSeg - 24 * 60 * 60
End If
Loop
End Sub


Llamada: pause segundos

Sub Pause(interval)
Dim atime
atime = Timer
Do While Timer - atime < Val(interval)
DoEvents
Loop
End Sub



Muchas Gracias!

P.D: No conocia eso de "/trucosvisual.htm"  :o
Título: Re: [RESUELTO] [Duda] Como puedo retrazar la ejecucion de un Comando???
Publicado por: BlackZeroX en 14 Octubre 2009, 04:51 AM
mira es

Código (vb) [Seleccionar]

Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)

Private Sub Command1_Click()
DoEvents: Sleep 1200
Text1.Text = "hola!"
DoEvents: Sleep 1233
Text1.Text = "jeje"
DoEvents: Sleep 1212
Text1.Text = "ÑÑÑ"
End Sub