Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# - Use form instead of messagebox

Tags:

c#

messagebox

I am working on an application for work and I need a customized messagebox to appear. I have created a simple form called Alert.cs that I have styled the way I want and added one button with a click method of this.Close(). now I want it to behave exactly like a standard messagebox.show(). I have the form showing but when I use the standard messagebox.show("text of alert") it waits to continue operation until the user click 'OK', this is what I want the form to do.

like image 248
Jake Sankey Avatar asked Mar 01 '10 06:03

Jake Sankey


1 Answers

Use Form.ShowDialog();. This allows the form to act the same way as a MessageBox in the sense that it retains focus until closed.

like image 176
Kyle Rosendo Avatar answered Oct 14 '22 20:10

Kyle Rosendo