Solved

c# winforms class to display 'please wait'

Posted on 2013-06-13
6
3,361 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
  • 3
  • 3
6 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
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
Comment Utility
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
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:cycledude
Comment Utility
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
Comment Utility
;o)
0
 
LVL 44

Expert Comment

by:AndyAinscow
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now