In this example we will learn that how to use
showdialog method in vb.net to display a windows form. When we use this method then form will be open as dialog.
You can use this method to display a modal dialog box in your application. When this method is called, the code following it is not executed until after the dialog box is closed.
Suppose you have two windows form (
Form1 has one button named
Button1. And you need to display
Form2 as dialog on the click of
Button1 of the
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim objForm As New Form2 objForm.showDialog() End Sub
How to place a Windows Form on Top
If you want to make a form the top-most form in a Windows Forms application at design time then you need to set the
TopMost property to true in the Properties window. You can also make a form the top-most form in a Windows Forms application programmatically.
Form1.TopMost = True
Form1.TopMost = true;