?
Solved

c# winforms class to display 'please wait'

Posted on 2013-06-13
6
Medium Priority
?
4,384 Views
Last Modified: 2013-06-13
Hi

I am trying to create a class that displays a message in a panel which is centered on the screen... a simple 'please wait' would be fine, so that I can call something like

busy()

to display the message no matter what form is open in the application...

Any ideas how I get this to work?

Cheers

CD
0
Comment
Question by:cycledude
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 39246691
Basically just how you described it.  Just use the .Show() method to show the window - that does not wait at that point.  In the form properties there is a setting for it to display centrally.

eg.
MyWaitForm frm = new MyWaitForm();
frm.Show();
....  //your code goes here
frm.Close();
0
 

Author Comment

by:cycledude
ID: 39246703
ah i see, so create a form with the message in it and then display the form...
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 2000 total points
ID: 39246711
Yes - or you could even pass a message into the form if you wanted different messages from the default you supply.

MyWaitForm frm = new MyWaitForm();
frm.DisplayMessage("Hello");
frm.Show();
....  //your code goes here
frm.Close();

in the form
public void DisplayMessage(String s)
{
  this.MessageLabel.Text = s;  //MessageLabel is the control you display the 'Please Wait' in
}
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:cycledude
ID: 39246725
so simple

I was thinking of creating a class, which created a panel in code then added a label and an image, then set the message... but this is way easier.. thanks
0
 

Author Closing Comment

by:cycledude
ID: 39246726
;o)
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 39246751
The trick is the .Show() so it doesn't block the code.  However it does require you to close the form from code yourself.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question