|
|
Title | Keep a form on top of all others in Visual Basic .NET |
Description | This example shows how to keep a form on top of all others in Visual Basic .NET. |
Keywords | top most, topmost, on top, ontop, Form, VB.NET |
Categories | VB.NET, Tips and Tricks, Controls |
|
|
In Visual Basic 6, making a form stay on top of all others is a bit of a hassle, requiring that you use an API function. In Visual Basic .NET, it's easy. Simply set the form's TopMost property to True either at design time or at run time.
The following code switches the form's TopMost property when the user checks or unchecks the chkTopmost check box.
|
|
Private Sub chkTopmost_CheckedChanged(ByVal sender As _
System.Object, ByVal e
As System.EventArgs) Handles chkTopmost.CheckedChanged
Me.TopMost = chkTopmost.Checked
End Sub
|
|
|
|
|
|