[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5058
  • Last Modified:

c# winforms class to display 'please wait'

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
cycledude
Asked:
cycledude
  • 3
  • 3
1 Solution
 
AndyAinscowFreelance programmer / ConsultantCommented:
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
 
cycledudeAuthor Commented:
ah i see, so create a form with the message in it and then display the form...
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
cycledudeAuthor Commented:
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
 
cycledudeAuthor Commented:
;o)
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now