473,372 Members | 1,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

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

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
10 17276
Just Me,

Why don't you just try it yourself?

Cor
Nov 21 '05 #2
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tee | last post by:
Hi, From my main form, I am executing another application using System.Diagnostics.Process.Start. The application has its own window displaying when the applicaiton is run. I want to change...
1
by: Riccardo Giomi | last post by:
Hi I would to display a Cursors.WaitCursor on a ListView control, so I tried listView.Cursor = Cursors.WaitCursor but it doesn't work at all, I see always the default cursor. The same thing...
5
by: Just Me | last post by:
I have a UserControl that contains a few controls on it. If when one of the buttons is clicked I want to, in the click event, set the cursor to Cursor = Cursors.WaitCursor I want the cursor...
5
by: Vlad Simionescu | last post by:
Hello I'm trying to let my Windows Form application perform a lengthy operation while displaying a progress bar in a modal dialog window; the dialog has a cancel button. The dialog is displayed...
2
by: Craig | last post by:
I'm trying to do this within a control I've created: Cursor.Current = Cursors.WaitCursor; During the initialization of the parent form, my control gets added to the form, and while the control...
2
by: dave | last post by:
In my form Ive got a SaveData() routine that saves changes to a DB. When I encounter an exception in the save operations, I am having trouble chaning the cursor back to the default cursor, it just...
4
by: Maria | last post by:
Hello ! I try to change the cursor on the form like this : Me.Cursor = Cursors.WaitCursor 'reading from database 'showing file Me.Cursor = Cursors.Arrow
8
by: Eddie | last post by:
Hi All, I just want to change the mouse cursor during a process. I want a hourglass... How may I do it ? Thx
6
by: a | last post by:
Hello, I am doing some multithreading in an MDI app, and I can't seem to get the cursor to stay as an Hourglass. I call: Cursor.Current = cursors.wait at the beginning of my routing, and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.