How to keep a Form on top of others in VB.NET?
When we create a Windows application, we want to keep the main form on top of another form. We can also say that when the application starts, a popup window form is displayed on top of the main form within the application to start the further process. In VB6 we can see a Win32API that call SetWindowPos to set the form always on top. And in VB.NET, it is simple to keep a form at the top using the TopMost property of the form as True. After setting the TopMost property to true, the Uppermost form of a Windows application that overlaps all other forms, even if the Uppermost form is not in the active or foreground form.
Furthermore, the TopMost property of the form will force the form to the top layer of the screen when the value of TopMost is true. And the Show() method is used to display the form in Windows Application.
The following syntax is used to set the form on top of others.
If we want to display a form on top of another form, we have to create two Windows Forms.
To keep the TopForm.vb Form on top of the MainPage.vb Form, we need to set the TopMost property in the MainPage.vb file to True.
In the above image, the TopForm is placed at the top of the ‘tutoraspire.com’ (MainPage). If we close the TopForm, it shows the form, shown below.
Provide the detail in the Student Registration form and click on the Submit button.
After Clicking on the Submit button, it shows a popup message on the top of the MainPage.vb file or tutoraspire.com Form.