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!
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.
Re: Changing TextBox through time
Quote:
Originally Posted by
MetalInquisitor
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?
Re: Changing TextBox through time
Quote:
Originally Posted by
CodyCoder
lol and what is the code for that?
Wondering the same thing.
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!
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.
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.
Re: Changing TextBox through time
Quote:
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!