我在双击列表视图项时创建表单的新实例。 .key是我为该表单创建的公共属性
Dim F2 As New NewForm()
F2.Name = "NewForm" & session.remoteIpAddress.ToString
F2.Key = session.sessionID
F2.Show()`
有人可以告诉我如何检查具有特定键值的NewForm实例是否已打开,如果是,则关闭它
答案 0 :(得分:0)
您可以查看OpenForms
。
For Each frm As Form In Application.OpenForms
If TypeOf frm Is NewForm Then
Dim nf As NewForm = DirectCast(frm, NewForm)
If nf.Key = "some key" Then
nf.Close()
Exit For
End If
End If
Next