Click here to Skip to main content
15,891,607 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Paint Event Problem Pin
Luc Pattyn15-May-12 14:31
sitebuilderLuc Pattyn15-May-12 14:31 
GeneralRe: Paint Event Problem Pin
Clark Kent1238-Nov-12 4:30
professionalClark Kent1238-Nov-12 4:30 
QuestionChanging JPG in picturebox with loop Pin
Dr David Johnson PhD14-May-12 12:02
Dr David Johnson PhD14-May-12 12:02 
AnswerRe: Changing JPG in picturebox with loop Pin
Dave Kreskowiak14-May-12 13:18
mveDave Kreskowiak14-May-12 13:18 
GeneralRe: Changing JPG in picturebox with loop Pin
Dr David Johnson PhD14-May-12 15:29
Dr David Johnson PhD14-May-12 15:29 
AnswerRe: Changing JPG in picturebox with loop Pin
Luc Pattyn14-May-12 15:43
sitebuilderLuc Pattyn14-May-12 15:43 
GeneralRe: Changing JPG in picturebox with loop Pin
Dr David Johnson PhD14-May-12 17:14
Dr David Johnson PhD14-May-12 17:14 
AnswerRe: Changing JPG in picturebox with loop Pin
Luc Pattyn14-May-12 17:34
sitebuilderLuc Pattyn14-May-12 17:34 
timer 101:
- create an instance of System.Windows.Forms.Timer
- set its Interval in milliseconds
- give it a Tick handler (a method that "Handles ...Tick"
- launch it by calling its Start method
- DONE: the tick handler will be executed periodically until you explicitly stop the timer.

Yes, the .NET timers are "free running" by default: once started, they keep "ticking" until you stop them. And you can change their Interval any time you like, in case you want the wheels to slow down.

any delay you want is built in the timer, that is what the Interval property is for (e.g. for your alarm clock, the Interval would be 24 hours).

What you need is a "state variable", i.e. one or more data items that know how far your machine has moved. Say you start the timer inside the SpinButton_Click handler, and set a variable "digit" to 0.

Now inside the timer's Tick Handler, you increment "digit" (up to its maximum value, then reset it to zero), and order a repaint of your Form (or a reload of an image in a PictureBox), where the new content depends on "digit". That will make the wheels spin, until you decide it was enough, so you probably need a random number "maxTicks", and after maxTicks ticks of the timer, you stop the timer, and hence the wheels.

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum

GeneralRe: Changing JPG in picturebox with loop Pin
Dr David Johnson PhD14-May-12 17:59
Dr David Johnson PhD14-May-12 17:59 
GeneralRe: Changing JPG in picturebox with loop Pin
dg6yhw1115-May-12 6:38
dg6yhw1115-May-12 6:38 
GeneralRe: Changing JPG in picturebox with loop Pin
Dr David Johnson PhD15-May-12 11:24
Dr David Johnson PhD15-May-12 11:24 
AnswerRe: Changing JPG in picturebox with loop Pin
Luc Pattyn15-May-12 12:06
sitebuilderLuc Pattyn15-May-12 12:06 
QuestionDevshock.Net Pin
Midnight Ahri13-May-12 17:15
Midnight Ahri13-May-12 17:15 
AnswerRe: Devshock.Net Pin
Richard MacCutchan13-May-12 22:01
mveRichard MacCutchan13-May-12 22:01 
GeneralRe: Devshock.Net Pin
Midnight Ahri13-May-12 22:42
Midnight Ahri13-May-12 22:42 
GeneralRe: Devshock.Net Pin
Richard MacCutchan13-May-12 22:48
mveRichard MacCutchan13-May-12 22:48 
AnswerRe: Devshock.Net Pin
Midnight Ahri13-May-12 23:52
Midnight Ahri13-May-12 23:52 
GeneralRe: Devshock.Net Pin
Richard MacCutchan14-May-12 0:05
mveRichard MacCutchan14-May-12 0:05 
GeneralRe: Devshock.Net Pin
Richard MacCutchan14-May-12 0:19
mveRichard MacCutchan14-May-12 0:19 
GeneralRe: Devshock.Net Pin
Luc Pattyn14-May-12 0:52
sitebuilderLuc Pattyn14-May-12 0:52 
GeneralRe: Devshock.Net Pin
Richard MacCutchan14-May-12 0:56
mveRichard MacCutchan14-May-12 0:56 
AnswerRe: Devshock.Net Pin
Dave Kreskowiak14-May-12 2:13
mveDave Kreskowiak14-May-12 2:13 
Questionhow to controll cells inside Table1DataGridView Pin
romo2213-May-12 12:58
romo2213-May-12 12:58 
AnswerRe: how to controll cells inside Table1DataGridView Pin
JohnPayton13-May-12 15:34
JohnPayton13-May-12 15:34 
GeneralRe: how to controll cells inside Table1DataGridView Pin
romo2213-May-12 16:47
romo2213-May-12 16:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.