Can't change to WaitCursor when showing a modal dialog

I've got a simple C# app built in VS2005. When I click a menu item a modal
form opens and performs a lengthy operation in the Load event handler to
populate a text control, so it takes a few seconds before the modal form is
actually displayed. I would like to change the cursor to the WaitCursor
between the time that the menu item is clicked and the modal form is actually
visible.

I've tried setting the form's cursor in the Load event handler:

private void OnFormLoad(object sender,EventArgs e)
{
Cursor oOldCursor=this.Cursor;
this.Cursor = Cursors.WaitCursor;
Application.DoEvents();
try
{
...
}
finally
{
this.Cursor = m_oOldCursor;
}
}

Sometimes the cursor changes, sometimes not, sometimes it just flashes
briefly. I've also tried using Application.UseWaitCursor, Cursor.Current, to
no effect. I've also tried all these in the main form before showing the
modal form. For example:

// in the main form
Cursor.Current = Cursors.WaitCursor;
MyForm frm=new MyForm();
frm.ShowDialog(this);

Any suggestions on how to get this to work?
km [ Fr, 01 Februar 2008 19:10 ] [ ID #1921564 ]
Microsoft » microsoft.public.dotnet.general » Can't change to WaitCursor when showing a modal dialog

Vorheriges Thema: OPENING MY DOCUMENTS - WORD 2002
Nächstes Thema: Time Resets on Reboot