|
-
Sep 21st, 2011, 09:26 AM
#1
Thread Starter
Lively Member
Add text after few seconds
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?
-
Sep 21st, 2011, 09:59 AM
#2
Addicted Member
Re: Add text after few seconds
 Originally Posted by Stunt3r
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
-
Sep 21st, 2011, 10:11 AM
#3
Thread Starter
Lively Member
Re: Add text after few seconds
There is my code:
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
But "Fix Errors..." not appear...
Timer1 settings: false / interval: 1000
-
Sep 21st, 2011, 10:42 AM
#4
Re: Add text after few seconds
Try this:
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
You're supposed to increment the integer "myvar" by one if "myvar" is not equal to 10.
Hope this helps..
Manny Pacquiao once posted in his twitter:
It doesn't matter if the grammar is wrong, what matter is that you get the message
-
Sep 21st, 2011, 11:05 AM
#5
Hyperactive Member
Re: Add text after few seconds
 Originally Posted by louvelle
Try this:
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
You're supposed to increment the integer "myvar" by one if "myvar" is not equal to 10.
Hope this helps.. 
I guess Public myvar should be equal to 10 in this case.
.
Edit : Oops sorry, thought that the timer was set to 10000.
Last edited by Ram2Curious; Sep 21st, 2011 at 12:24 PM.
-
Sep 21st, 2011, 12:03 PM
#6
Addicted Member
Re: Add text after few seconds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|