A small tip to show a busy cursor in Winforms applications

I learnt this when reviewing my colleague's code.

try 
{
    Cursor.Current = Cursors.WaitCursor;
    // do some time-consuming job
}
finally
{
    Cursor.Current = Cursors.Default;
}

Comments

  1. Markdown is allowed. HTML tags allowed: <strong>, <em>, <blockquote>, <code>, <pre>, <a>.