Current Cursor Question

  • Thread starter Thread starter Erik Jensen
  • Start date Start date
E

Erik Jensen

Hi, in my main application class i'm able to write

Cursor.Current = Cursors.WaitCursor;

However, in a different class I have to write:

this.Cursor = Cursors.WaitCursor;

it says Ambiguous reference when I try and write it the
first way.

Can anyone shed some light on this for me?

thanks
 
Because the control classes have a Cursor property. If you refer to Cursor
inside you control class - there's an ambiguous meaning. You either mean to
call a static property on the Cursor class or try to set the Cursor property
for your control.

What you want to do in the first statement is set the static property
Current on the Cursor class - which will apply, regardless of which Control
has the focus.

In order to avoid this you could use namespace aliasing, or simply specify
the full namespace path:

System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;

HTH,
Wim Hollebrandse
http://www.wimdows.com
http://www.wimdows.net
 
Back
Top