By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,247 Members | 871 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,247 IT Pros & Developers. It's quick & easy.

What's the difference between Cursor = Cursors.WaitCursor and CurrentCursor=Cursors.WaitCursor

P: n/a
Does Me.Cursor.Current=Cursors.WaitCursor
set the current property of Me.Cursor to Cursors.WaitCursor
And Me.Cursor.Current=Cursors.Default set the Me.Current
property to something (default) stored in Me.Cursor.

Or is Cursors.Default some process wide cursor shape?

What is a correct statement?
I the top statement is correct what happens if I do
Me.Cursor=Cursors.WaitCursor
Me.Cursor=Cursors.Default

Thanks

Nov 21 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Just Me,

Why don't you just try it yourself?

Cor
Nov 21 '05 #2

P: n/a
Try what? I've been playing with it already and reading the Help.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:em**************@tk2msftngp13.phx.gbl...
Just Me,

Why don't you just try it yourself?

Cor

Nov 21 '05 #3

P: n/a
Just Me,
Assuming your sample code is in a Form.

"Cursor" is both a type (System.Windows.Forms.Cursor)
http://msdn.microsoft.com/library/de...classtopic.asp

and a property (Control.Cursor)
http://msdn.microsoft.com/library/de...ursortopic.asp
Current is a Shared property of the Cursor type.

http://msdn.microsoft.com/library/de...rrentTopic.asp
Control.Cursor gets & sets the control's (form's) cursor. Each control can
have a different cursor. Remember that Form inherits (indirectly) from
Control.

Cursor.Current gets & sets the application's cursor. Which can be overriden
by individual forms via Control.Cursor.

Hope this helps
Jay

" Just Me" <gr****@a-znet.com> wrote in message
news:eS**************@TK2MSFTNGP09.phx.gbl...
Does Me.Cursor.Current=Cursors.WaitCursor
set the current property of Me.Cursor to Cursors.WaitCursor
And Me.Cursor.Current=Cursors.Default set the Me.Current
property to something (default) stored in Me.Cursor.

Or is Cursors.Default some process wide cursor shape?

What is a correct statement?
I the top statement is correct what happens if I do
Me.Cursor=Cursors.WaitCursor
Me.Cursor=Cursors.Default

Thanks

Nov 21 '05 #4

P: n/a
I'm still confused about Cursors.Default.
What is that?

Thanks for the previous reply

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:Ow**************@TK2MSFTNGP10.phx.gbl...
Just Me,
Assuming your sample code is in a Form.

"Cursor" is both a type (System.Windows.Forms.Cursor)
http://msdn.microsoft.com/library/de...classtopic.asp

and a property (Control.Cursor)
http://msdn.microsoft.com/library/de...ursortopic.asp
Current is a Shared property of the Cursor type.

http://msdn.microsoft.com/library/de...rrentTopic.asp
Control.Cursor gets & sets the control's (form's) cursor. Each control can
have a different cursor. Remember that Form inherits (indirectly) from
Control.

Cursor.Current gets & sets the application's cursor. Which can be
overriden by individual forms via Control.Cursor.

Hope this helps
Jay

" Just Me" <gr****@a-znet.com> wrote in message
news:eS**************@TK2MSFTNGP09.phx.gbl...
Does Me.Cursor.Current=Cursors.WaitCursor
set the current property of Me.Cursor to Cursors.WaitCursor
And Me.Cursor.Current=Cursors.Default set the Me.Current
property to something (default) stored in Me.Cursor.

Or is Cursors.Default some process wide cursor shape?

What is a correct statement?
I the top statement is correct what happens if I do
Me.Cursor=Cursors.WaitCursor
Me.Cursor=Cursors.Default

Thanks


Nov 21 '05 #5

P: n/a
Just Me,
It is the "normal select" mouse pointer defined under Win32 Control Panel.

Normally you only need to set Cursor.Current = Cursors.WaitCursor, once your
event finishes Cursor.Current will revert back to Cursors.Default, as
Application.DoEvents will implicitly have be executed.

Where you need to be careful is if you explicitly call Application.DoEvents
while processing an event. Cursor.Current will revert back to
Cursors.Default. (The remarks under Cursor.Current.)

Remember that .NET looks at the Control.Cursor property under the mouse to
display the cursor, if Control.Cursor = Cursors.Default it will look at
Cursor.Current.

Also remember if you don't explicitly set Control.Cursor it will be set to
the value of its parent, which ultimately will be a Form...

Hope this helps
Jay
" Just Me" <gr****@a-znet.com> wrote in message
news:u5**************@TK2MSFTNGP14.phx.gbl...
I'm still confused about Cursors.Default.
What is that?

Thanks for the previous reply

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:Ow**************@TK2MSFTNGP10.phx.gbl...
Just Me,
Assuming your sample code is in a Form.

"Cursor" is both a type (System.Windows.Forms.Cursor)
http://msdn.microsoft.com/library/de...classtopic.asp

and a property (Control.Cursor)
http://msdn.microsoft.com/library/de...ursortopic.asp
Current is a Shared property of the Cursor type.

http://msdn.microsoft.com/library/de...rrentTopic.asp
Control.Cursor gets & sets the control's (form's) cursor. Each control
can have a different cursor. Remember that Form inherits (indirectly)
from Control.

Cursor.Current gets & sets the application's cursor. Which can be
overriden by individual forms via Control.Cursor.

Hope this helps
Jay

" Just Me" <gr****@a-znet.com> wrote in message
news:eS**************@TK2MSFTNGP09.phx.gbl...
Does Me.Cursor.Current=Cursors.WaitCursor
set the current property of Me.Cursor to Cursors.WaitCursor
And Me.Cursor.Current=Cursors.Default set the Me.Current
property to something (default) stored in Me.Cursor.

Or is Cursors.Default some process wide cursor shape?

What is a correct statement?
I the top statement is correct what happens if I do
Me.Cursor=Cursors.WaitCursor
Me.Cursor=Cursors.Default

Thanks



Nov 21 '05 #6

P: n/a
That's great

Thanks

"> Where you need to be careful is if you explicitly call
Application.DoEvents
while processing an event. Cursor.Current will revert back to
Cursors.Default. (The remarks under Cursor.Current.)


I had read those remarks and that's when I got confused. How do you handle
that situation if you explicitly call Application.DoEvents?

I suppose in most cases I do know that the cursor should be Wait where I do
Application.DoEvents and could set Cursor.Current to wait there, but that
seems messy.

Suppose I have a library routine that contains an Application.DoEvents!
There I may not know how the Cursor should be set.

Maybe instead of Cursor.Current I could set Me.Cursor - have to think about
that.

Nov 21 '05 #7

P: n/a
Just Me,
I had read those remarks and that's when I got confused. How do you handle
that situation if you explicitly call Application.DoEvents? I rarely call Application.DoEvents! Instead I (normally) rely on threading
for long running tasks.
Suppose I have a library routine that contains an Application.DoEvents!
There I may not know how the Cursor should be set. You could save the current Cursor.Current before you call
Application.DoEvents, then restore it when you are done. Something like:

Dim current As Cursor = Cursor.Current
Application.DoEvents()
Cursor.Current = current

Alternatively you could set Me.Cursor.
Maybe instead of Cursor.Current I could set Me.Cursor - have to think
about that. The problem with Me.Cursor is that you need to remember to set it back, for
example if an exception occurred! Plus if you ever change Me.Cursor in the
forms designer, every place you set it back would need to change!

I prefer setting Cursor.Current as it can occur anyplace, and the system
will automatically set it back to an arrow for me.

Hope this helps
Jay
" Just Me" <gr****@a-znet.com> wrote in message
news:ey**************@TK2MSFTNGP15.phx.gbl... That's great

Thanks

"> Where you need to be careful is if you explicitly call
Application.DoEvents
while processing an event. Cursor.Current will revert back to
Cursors.Default. (The remarks under Cursor.Current.)


I had read those remarks and that's when I got confused. How do you handle
that situation if you explicitly call Application.DoEvents?

I suppose in most cases I do know that the cursor should be Wait where I
do Application.DoEvents and could set Cursor.Current to wait there, but
that seems messy.

Suppose I have a library routine that contains an Application.DoEvents!
There I may not know how the Cursor should be set.

Maybe instead of Cursor.Current I could set Me.Cursor - have to think
about that.

Nov 21 '05 #8

P: n/a
Thanks, especially telling what you prefer since it displays an experienced
decision that I can use until I feel confident.
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Just Me,
I had read those remarks and that's when I got confused. How do you
handle that situation if you explicitly call Application.DoEvents?

I rarely call Application.DoEvents! Instead I (normally) rely on threading
for long running tasks.
Suppose I have a library routine that contains an Application.DoEvents!
There I may not know how the Cursor should be set.

You could save the current Cursor.Current before you call
Application.DoEvents, then restore it when you are done. Something like:

Dim current As Cursor = Cursor.Current
Application.DoEvents()
Cursor.Current = current

Alternatively you could set Me.Cursor.
Maybe instead of Cursor.Current I could set Me.Cursor - have to think
about that.

The problem with Me.Cursor is that you need to remember to set it back,
for example if an exception occurred! Plus if you ever change Me.Cursor in
the forms designer, every place you set it back would need to change!

I prefer setting Cursor.Current as it can occur anyplace, and the system
will automatically set it back to an arrow for me.

Hope this helps
Jay
" Just Me" <gr****@a-znet.com> wrote in message
news:ey**************@TK2MSFTNGP15.phx.gbl...
That's great

Thanks

"> Where you need to be careful is if you explicitly call
Application.DoEvents
while processing an event. Cursor.Current will revert back to
Cursors.Default. (The remarks under Cursor.Current.)


I had read those remarks and that's when I got confused. How do you
handle that situation if you explicitly call Application.DoEvents?

I suppose in most cases I do know that the cursor should be Wait where I
do Application.DoEvents and could set Cursor.Current to wait there, but
that seems messy.

Suppose I have a library routine that contains an Application.DoEvents!
There I may not know how the Cursor should be set.

Maybe instead of Cursor.Current I could set Me.Cursor - have to think
about that.


Nov 21 '05 #9

P: n/a
Just Me,
I should add I have one app where I set Control.Cursor based on the
MouseMove event.

Its a custom control, the control is partitioned into a grid (similar to a
chess board) if the mouse moves over a square that is "occupied" I set
Me.Cursor to Cursors.Hand if the square is not occupied I set Me.Cursor to
Cursors.Arrow. Using Cursor.Current in this instance won't work as
Cursor.Current stops listening to the Mouse...

I prefer to use Cursor.Current for actions that I need to use
Cursors.WaitCursor, such as File Save that is normally short enough not to
use a thread...

Hope this helps
Jay

" Just Me" <gr****@a-znet.com> wrote in message
news:uU**************@TK2MSFTNGP09.phx.gbl...
Thanks, especially telling what you prefer since it displays an
experienced decision that I can use until I feel confident.
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Just Me,
I had read those remarks and that's when I got confused. How do you
handle that situation if you explicitly call Application.DoEvents?

I rarely call Application.DoEvents! Instead I (normally) rely on
threading for long running tasks.
Suppose I have a library routine that contains an Application.DoEvents!
There I may not know how the Cursor should be set.

You could save the current Cursor.Current before you call
Application.DoEvents, then restore it when you are done. Something like:

Dim current As Cursor = Cursor.Current
Application.DoEvents()
Cursor.Current = current

Alternatively you could set Me.Cursor.
Maybe instead of Cursor.Current I could set Me.Cursor - have to think
about that.

The problem with Me.Cursor is that you need to remember to set it back,
for example if an exception occurred! Plus if you ever change Me.Cursor
in the forms designer, every place you set it back would need to change!

I prefer setting Cursor.Current as it can occur anyplace, and the system
will automatically set it back to an arrow for me.

Hope this helps
Jay
" Just Me" <gr****@a-znet.com> wrote in message
news:ey**************@TK2MSFTNGP15.phx.gbl...
That's great

Thanks

"> Where you need to be careful is if you explicitly call
Application.DoEvents
while processing an event. Cursor.Current will revert back to
Cursors.Default. (The remarks under Cursor.Current.)

I had read those remarks and that's when I got confused. How do you
handle that situation if you explicitly call Application.DoEvents?

I suppose in most cases I do know that the cursor should be Wait where I
do Application.DoEvents and could set Cursor.Current to wait there, but
that seems messy.

Suppose I have a library routine that contains an Application.DoEvents!
There I may not know how the Cursor should be set.

Maybe instead of Cursor.Current I could set Me.Cursor - have to think
about that.



Nov 21 '05 #10

P: n/a
Thanks for all the input.
At first I didn't like the fact that cursor.current might get set back to
Cursors.Default but now I like the idea. I have had programs get stuck with
the wait symbol (maybe because of an error of cancel) which would be
unlikely with cursor.current

Thanks again
Nov 21 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.