Check if form is Opened

前端 未结 8 1437
陌清茗
陌清茗 2020-12-30 23:56

I give this question for more knowledge. How can I know if the form is Opened in my application or not, in order not to open it again I mean not to create an instance of the

8条回答
  •  孤独总比滥情好
    2020-12-31 00:39

    Hate to be a kill joy but some day some one is going to try and understand your code.

    Dim frm as New frmDontknow
    Dim frmCollection = System.Windows.Forms.Application.OpenForms
    For i As Int16 = 0I To frmCollection.Count - 1I
      If frmCollection.Item(i).Name = frm.Name Then
          frmCollection.Item(i).Activate()
          Exit Sub
      End If
    Next i
    

    Then do the show etc as required?

提交回复
热议问题