Saturday, March 29, 2008

How To Find a Form in Open Forms

Title: Finding Form in Open Forms
Issue: How to find a Form whether it is already opened or NOT
Level: Beginner
Knowledge Required:
To understand the solution you must have the knowledge of following things
  • For Each Loop
  • Win Forms

Description:
Sometimes it is required to find a Form in Open Forms, for this purpose we can use the following code:

For Each frmEach As Form In My.Application.OpenForms
    If TypeOf frmEach Is frmManageOrders Then 
        frmEach.Show()
        frmEach.Activate()
        Exit For
    End If
Next

No comments: