469,613 Members | 2,028 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,613 developers. It's quick & easy.

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?

Feb 1 '08 #1
0 1630

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Joe | last post: by
2 posts views Thread by Craig | last post: by
8 posts views Thread by Craig G | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.