子窗口的更新
父窗口下有很多子窗口现在有一个MSGBOX,当MSGBOX点击后,
立即对当前的活动子窗口进行重加载
即执行form_load
有什么方法?
[此贴子已经被作者于2018-12-8 09:27编辑过]
'Form1 的代码,上面有二个按钮。第一个是开始测试,第二个是退出。 Option Explicit Private Sub Command1_Click() '加载窗体进行测试 Dim i As Long Dim fr As Form2 For i = 1 To 5 Set fr = New Form2 fr.Timer1.Interval = Rnd() * 10000 + 1000 fr.Timer1.Enabled = True fr.Caption = "F" & i fr.Show Next i End Sub Private Sub Command2_Click() '删窗体退出 Dim fr As Form For Each fr In Forms Unload fr Next End Sub
'Form2代码,产生 MSBGOX 用的是定时器来产生 Option Explicit Private Sub Timer1_Timer() MsgBox Timer1.Interval, vbOKOnly, Me.Caption '提示 Screen.ActiveForm.Print Me.Caption '在活动窗体上显示内容 Dim fr As Form Form1.Print "当前活动窗口是:" & Screen.ActiveForm.Caption Set fr = Screen.ActiveForm '直接给活动窗体 End Sub
[此贴子已经被作者于2018-12-10 10:21编辑过]