# Re: Answer "Form是否已经Load进来了？"

Posted by Spencer Yang on March 27, 1999 at 12:33:10:

In Reply to: Form是否已经Load进来了？ posted by 泰维 on March 27, 1999 at 00:51:18:

说明:
1)将要比对的表单名称放置于阵列 strX(0 to n)
2)已经载入的表单名称于置于阵列 strY(0 to n)
3)再比较 "比对组" 与 "载入组" 名称, 假如 strcomp 结果不等于 0者, 颢示不符等资讯。

Private Sub Form_Activate()
Dim I '计数变数
Dim J '计数变数
Dim K '计数变数
Dim L '计数变数
Dim MyComp As Variant
Dim strX(0 To 2) As String
Dim strY(0 To 2) As String
' 设定要比较的表单名称(本人测试用的)
strX(0) = "frmCompanyInput"
strX(1) = "frmCalendar"
strX(2) = "frmX"
For I = 0 To Forms.count - 1
strY(I) = Forms(I).Name
J = J + 1
Next I
For K = 0 To 2
For L = 0 To J - 1
MyComp = StrComp(strX(K), strY(L), vbTextCompare)
If MyComp <> 0 Then
Debug.Print "the " & strX(K) & " unload."
End If
Next L
Next K
End Sub

Follow Ups:

- Re: Thanks to Spencer Yang 泰维 01:43:13 3/28/99 (0)