473,396 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1846

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Joe | last post by:
Is there a way to enable scrolling in a modal dialog box even if the call to open the modal has "scroll:no"? I am looking to dynamically size the modal dialog box for starters and if the modal is...
2
by: Craig | last post by:
I'm trying to do this within a control I've created: Cursor.Current = Cursors.WaitCursor; During the initialization of the parent form, my control gets added to the form, and while the control...
8
by: Craig G | last post by:
i have a page with a grid that is opened in a modal dialog. when it posts back it opens a new window for the page can it postback to itself? i tried setting the target of the form showing within...
6
by: Lars | last post by:
Hi, I have created a simple custom PrintPreviewDialog consisting of a simple standard PrintPreviewControl (.NET 1.1) on a WindowsForm with a few buttons (for printing, zooming, etc.). It is...
3
by: mccoyn | last post by:
When I have a long process to run I can create a new thread to run it and create a modal dialog on my GUI thread. The modal dialog prevents any messages (like button clicks) from working on my...
1
by: Henry Lee | last post by:
hi , all This is driving me crazy , I use msgbox method in .net 2.0 environment and it is running fine on my IIS (Windows 2000) until today. The error is like "Showing a modal dialog box or form...
2
by: Smokey Grindle | last post by:
I have an MDI app, that has a Modal (non MDI child) form that shows up in it's properties that performs a very long task, I want the wait cursor to show over the entire application... when I do...
6
by: Jan Heppen | last post by:
Is it posible to set something so that when my vb.net (visual studio 2005, framework 2.0) application is busy that the mouse pointer change into a hourglass ? Or do i have to set everywhere...
4
by: forest demon | last post by:
i've seen previous posts somewhat related to this, so i apologize if this is redundant. I have a main form with separate threads. When showing a dialog like <dialog>.ShowDialog(), it functions...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.