Results 1 to 6 of 6

Thread: Add text after few seconds

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2011
    Posts
    85

    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?

  2. #2
    Addicted Member
    Join Date
    Jan 2011
    Posts
    154

    Re: Add text after few seconds

    Quote Originally Posted by Stunt3r View Post
    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

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2011
    Posts
    85

    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

  4. #4
    Fanatic Member louvelle's Avatar
    Join Date
    Jun 2008
    Posts
    513

    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

  5. #5
    Hyperactive Member Ram2Curious's Avatar
    Join Date
    Apr 2010
    Posts
    484

    Re: Add text after few seconds

    Quote Originally Posted by louvelle View Post
    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.

  6. #6
    Addicted Member
    Join Date
    Jan 2011
    Posts
    154

    Re: Add text after few seconds

    glad to help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width