Posts

Showing posts from March 31, 2021

VB.NET How to check if a Form is already Open

Image
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 ♥  Here are some online Visual Basic lessons and courses : 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 Clic