Solved

c# winforms class to display 'please wait'

Posted on 2013-06-13
6
4,036 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 500 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
Industry Leaders: 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# MVC Insert Multiple Row into DB 2 98
Upgrade code from VS 2010 to VS 2015 7 45
Convert VB web project to C# 3 66
.Net remove carriage returns, line feeds and tabbs 5 36
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

732 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