如: 我要在关闭MDI窗口时判断各个子窗口是否都保存了数据!(子窗口中有个变量:isRead)如果没保存则调用子窗口的of_Save 方法,然后关闭子窗口!
最后才关闭MDI窗口所有的子窗口都是同样的变量(isRead )和同样的方法(of_Save)
请问如保做到啊!所有分都拿来求解,望高手指点!
最后才关闭MDI窗口所有的子窗口都是同样的变量(isRead )和同样的方法(of_Save)
请问如保做到啊!所有分都拿来求解,望高手指点!
Dim tempControl As Object
For Each tempControl In Forms
If tempControl.Name <> MDIForm1.Name Then
if tempControl.isRead=false then'如果没有
tempControl.of_Save
end if
End If
Next
End Sub
下面的程序你改改,应该能用
Public Sub Shutdown(Optional ByVal Force As Boolean = False)
Dim i As Long
Dim X As Integer
On Error Resume Next
For i = Forms.Count - 1 To 0 Step -1
Unload Forms(i)
If Not Force Then
If Forms.Count > i Then
Exit Sub
End If
End If
Next i
If Force Or (Forms.Count = 0) Then Close
If Force Or (Forms.Count > 0) Then End
End Sub