Results 1 to 8 of 8

Thread: Changing TextBox through time

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    2

    Changing TextBox through time

    To first start off, I am completely new to coding. I just now started vb.net not too long ago. I was wondering how I would make a TextBox's text change like every five seconds. For example, I have a Text Box currently set to nothing. When I click a button, it will change the text, then it will wait 3 seconds and the text would change to something else... and so on. Sorry for the run on sentence, haha. If anyone could help, it would be much appreciated!

    Thanks!

  2. #2
    Addicted Member MetalInquisitor's Avatar
    Join Date
    Sep 2012
    Posts
    143

    Re: Changing TextBox through time

    You could use a Timer, set its interval to 3000 (3 seconds) and on its Tick event you change the text of the Textbox.

  3. #3
    New Member
    Join Date
    Apr 2013
    Posts
    12

    Re: Changing TextBox through time

    Quote Originally Posted by MetalInquisitor View Post
    You could use a Timer, set its interval to 3000 (3 seconds) and on its Tick event you change the text of the Textbox.
    lol and what is the code for that?

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    2

    Re: Changing TextBox through time

    Quote Originally Posted by CodyCoder View Post
    lol and what is the code for that?
    Wondering the same thing.

  5. #5
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Changing TextBox through time

    TextBox and Timer. Hardly the most complex controls on the board. Look it up and see if you can work it out! You should be able to do it with three lines of code, two of which the IDE will write for you!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  6. #6
    Addicted Member MetalInquisitor's Avatar
    Join Date
    Sep 2012
    Posts
    143

    Re: Changing TextBox through time

    -You add a Timer to your Form.
    -In the Timer properties, you set the Interval to 3000, so that the Timer's Tick event fires every 3 seconds.
    -In the Timer's Tick event you write code to display whatever it is you want on the TextBox.
    -On the Button Click event you start the Timer.

    That's about it.

  7. #7
    New Member
    Join Date
    Apr 2013
    Posts
    12

    Re: Changing TextBox through time

    I know but like as far as ive learned in vb if you told it to textbox1's text = whatever, that changes, but how do you get it to 15 + items for example... to alternate between random ones, maybe do select case statements in the timer tick event.

  8. #8
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Changing TextBox through time

    maybe do select case statements in the timer tick event
    Maybe! Here's a crazy idea. Try it and see. You learn nothing from having everything done for you!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

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