VB.NET How to check if a Form is already Open
VB.NET How to check if a Form is already Open
Check if Form is open in Visual Basic .NET |
Visual Basic 2010 Windows Form [WinForm] Project
.NET 4
Microsoft Windows 10 32 or 64bit
Form1
Text : MainFrm.vb
Button1
Text : OK!
Form2
Text : SecondFrm.vb
Now, in order to check if Form2 is open or not, and if open then Show it, or if it is not open then Open it, the code would be.
- Public Class MainFrm
- Private Sub PictureBox4_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox4.Click
- OpnFrm = New SecondFrm
- If Application.OpenForms.OfType(Of SecondFrm).Any Then
- OpnFrm.Select()
- Exit Sub
- End If
- OpnFrm.Show(Me)
- End Sub
- End Class
- Visual Basic .Net - Create TextBox control with Event at Project Run-Time
- Visual Basic .Net - How to check for the internet connection
- Visual Basic .Net - POP3 and Receiving E-mails
- Visual Basic .Net - Generate Random Combinations
- Visual Basic .Net - Play sounds on Button Click or Mouse Hover
- Visual Basic .Net - Progressbar control
- Visual Basic .Net - The application failed to initialize
- Visual Basic .Net - Working with Database full example
- Visual Basic .Net - There is already an open DataReader associated
- Visual Basic .Net - SyBase Advantage Database [Add, Edit, Search, Delete and DataGridView]
- Visual Basic .Net - Math Functions
- Visual Basic .Net - Communicating with clients [Requirements Docs, Use-Case]
- Visual Basic .Net - SAP Crystal Reports Download and Installation guide
- Visual Basic .Net - Receive Emails using POP3 mail Server
- Visual Basic .Net - Dropbox Api DotNet Example Source Code