Form myForm = new Form(); myForm.Text = "My Dialog Box"; myForm.Show();
Form myForm = new Form(); myForm.Text = "My Modal Dialog Box"; myForm.ShowDialog();This code also creates a new instance of the Form class, sets its title to "My Modal Dialog Box," and displays it using the ShowDialog method. This makes the dialog box modal, so the user cannot interact with other windows until the dialog box is closed. In conclusion, the System.Windows.Forms package library provides classes for building Windows-based applications in C#, including the Form class. One of the Form class's methods, ShowDialog, is used to display modal dialog boxes.