8 Replies - 1672 Views - Last Post: 09 August 2012 - 12:41 PM Rate Topic: ***** 1 Votes

#1 voseo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-August 12

Label text change after some secs after button clicked?

Posted 09 August 2012 - 02:46 AM

Hello, googled some time about my problem, but no luck.
So this is what I basically want to do:

There is a label, and I want to change (text) it after 3 secs when the button is clicked....
So, I don't know how to use times, how to "play" with it..

So I'm using this code in button (lol) and I want this text to appear 3 secs later after the button is clicked.
Label1.Text = "hi" 


Is it possible?

Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Label text change after some secs after button clicked?

#2 voseo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-August 12

Re: Label text change after some secs after button clicked?

Posted 09 August 2012 - 03:50 AM

Bump! Anyone?
Was This Post Helpful? 0
  • +
  • -

#3 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,797
  • Joined: 26-March 09

Re: Label text change after some secs after button clicked?

Posted 09 August 2012 - 04:36 AM

Welcome to the forum..

Please be patient whilst waiting for a reply, we're not here at beck and call of everyone.

Have a look at the timer control.

Add a timer control to your form.

Set the interval property to 3000 (it's in milliseconds).

Set the enabled property to false.

In your button click, set the enabled property to true.

In the timer event, write the code to populate the label and set the timer enabled property to false to disable the timer again.

Have a go at putting the above into code...
Was This Post Helpful? 1
  • +
  • -

#4 voseo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-August 12

Re: Label text change after some secs after button clicked?

Posted 09 August 2012 - 05:43 AM

Yes, sorry for my impatience.

Thank ya very much, somehow, I managed to do it:D:)

Now, how can I put text in that 3000 miliseconds? I mean like this:

1.Label text: "Hello"
2.Button is clicked
3.Label text changes to "Processing"
4. And finally, when the 3000 miliseconds ends, the text changes fully to "Hi".

Hope you understand what I mean...It's kinda hard to explain these things in english to me....
Was This Post Helpful? 0
  • +
  • -

#5 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,797
  • Joined: 26-March 09

Re: Label text change after some secs after button clicked?

Posted 09 August 2012 - 05:47 AM

Maybe you could post the code that you have written, that way it makes it easier to suggest things to you.

Please use the [CODE ] tags in the menu above to wrap your code and it will format it for you.
Was This Post Helpful? 0
  • +
  • -

#6 voseo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-August 12

Re: Label text change after some secs after button clicked?

Posted 09 August 2012 - 08:01 AM

Ummm, well I got only one line code in general, and it's in timer1:
 Label1.Text = "Hi" 

Was This Post Helpful? 0
  • +
  • -

#7 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,797
  • Joined: 26-March 09

Re: Label text change after some secs after button clicked?

Posted 09 August 2012 - 08:16 AM

You said in your previous post that you go it, so if you got it, you should be able to have a go at the code at least past the single line that you have.
Was This Post Helpful? 0
  • +
  • -

#8 voseo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-August 12

Re: Label text change after some secs after button clicked?

Posted 09 August 2012 - 11:04 AM

Finally, I managed to do it:

 Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label1.Text = "Processing..."
        Timer1.Enabled = True

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Label1.Text = "Hi"
        Timer1.Enabled = False


    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub
End Class 



Thank you for all your help, sir!
Was This Post Helpful? 0
  • +
  • -

#9 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 303
  • View blog
  • Posts: 1,797
  • Joined: 26-March 09

Re: Label text change after some secs after button clicked?

Posted 09 August 2012 - 12:41 PM

No problem, just for future reference, you're working in VB.Net and this is the VB6 forum.

You may want to post in the correct forum next time and you'll get more targeted assistance.

Good luck in your learning.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1