Open windows form as modal dialog box in C#.Net

In this post, we will discuss how we can open windows form as a dialog box in C#.Net.
Also, you can check my previous posts on:
We can open a windows form as a dialog box by using the ShowDialog method of the windows form. Below is the code:
MaximizeTest objMaximizeTest = new MaximizeTest();
objMaximizeTest.ShowDialog();
Here MaximizeTest is the windows form name and we are calling the ShowDialog() Method of the class.
But if you want to return the DialogResult then you can write like below:
MaximizeTest objMaximizeTest = new MaximizeTest();
DialogResult result = objMaximizeTest.ShowDialog();
DialogResult is an enum which can contain a value like: Abort, Cancel, Ignore, No, None, OK, Retry, Yes.
According to these result, you can perform some action.

You May Also like the Following SharePoint Online Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →

Leave a Reply