Question

Is there a way when I click on a ToolStripButton, it shows the WaitCursor and updates the StatusStrip for about 10 seconds, then returns back to normal. I just don't know how to type in the coding.

If someone could guide me through the process. (or even give me the code)

Thank You

J Mahone

Was it helpful?

Solution

Using a timer:

1:Add a timer from your component toolbox to your form.

2:Set the inteval to 10,000 (this is in milliseconds, 1000 = 1 second)

3:In the timers' "Tick" event, write this code:

Timer1.stop 'This assumes your timer it named Timer1
Me.Cursor = Cursors.Default

4: When you want to make it show the cursor, either have a method to do both these lines and call the method or just write these 2 lines all over the place:

Me.Cursor = Cursors.WaitCursor
Timer1.Start

OTHER TIPS

I'd suggest to use async/await to keep the "normal" program flow.

Me.Cursor = Cursors.WaitCursor
Await Task.Delay(10000)
Me.Cursor = Cursors.Default
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top