PC Review


Reply
Thread Tools Rate Thread

Can't change to WaitCursor when showing a modal dialog

 
 
km
Guest
Posts: n/a
 
      1st Feb 2008
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?



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scheduling SyncToy on Vista = Exception: Showing a modal dialog bo =?Utf-8?B?V2FkZUE=?= Windows XP Photos 11 12th Feb 2008 11:44 AM
Can't change cursor to WaitCursor when showing modal form km Microsoft Dot NET Framework Forms 0 1st Feb 2008 06:22 PM
error:Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation Henry Lee Microsoft ASP .NET 1 3rd May 2006 11:25 PM
Minimizing then showing a Modal Dialog; Matt Budd Microsoft Dot NET Framework Forms 4 16th Mar 2004 09:45 PM
Re: Showing a modal dialog at application startup Herfried K. Wagner Microsoft Dot NET Framework Forms 0 27th Jun 2003 06:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:59 PM.