Hi guys.
I want when i press a button in richtextbox add a text then after 10 seconds the text changed.
Can I do this?
Printable View
Hi guys.
I want when i press a button in richtextbox add a text then after 10 seconds the text changed.
Can I do this?
i assume i got you right... all you need is an integer and a timer additional to your textbox and button...
steps:
-set your timers properties(interval to 1000 , enabled to false)
-public the variable as 0(type "public myvar as integer=0" out of procedures)
-then tell your timer to add 1 to i
-and type(if myvar=10 then yourtextbox.text = "type here" : timer1.enabled =false
-set the timer enabled=true when clicked tothe button
Ps: post your code if you have one so i can fix it
There is my code:
But "Fix Errors..." not appear...Code:Public Class Form1
Public myvar As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RichTextBox1.AppendText("Scanning...")
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If myvar = 10 Then
RichTextBox1.AppendText("Fix Errors...")
Timer1.Enabled = False
End If
End Sub
End Class
Timer1 settings: false / interval: 1000
Try this:
You're supposed to increment the integer "myvar" by one if "myvar" is not equal to 10.Code:
Public Class Form1
Public myvar As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RichTextBox1.AppendText("Scanning...")
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If myvar = 10 Then
RichTextBox1.AppendText("Fix Errors...")
Timer1.Enabled = False
Else
myvar = Val(myvar) + 1
End If
End Sub
End Class
Hope this helps.. :)
glad to help