문제

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

도움이 되었습니까?

해결책

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

다른 팁

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top