不用frm来提示,用frame,给您一个例子Private Sub ShowWait(Tip As String) lblWait.Caption = Tip FrameWait.Visible = True FrameWait.Refresh End Sub Screen.MousePointer = vbHourglass ShowWait "…生成报表中…" ....your code FrameWait.Visible = False Screen.MousePointer = vbDefault
你的program code 放在form load中,這時load並沒有完成,所以沒有顯示提示,你可以將program code 放在form 的一個事件中,如mouse_move中。然後,定義一個變量來判斷program code 已執行。 dim blnRunning as booleansub form_mousemove(...) if not blnRunning then program code blnRunning=true endif end sub
'让frm突前显示,在program code运行完成后,返回参数ok_reg frm.show 1 doevents program code if ok_reg then unload frm '如 program code 与远程控制、或其它硬件如打印机控制等状态转换有关, 可能还需通过以下代码来unload frm Call Sleep(1000*n) GoTo mylab0 mylab0: if ok_reg then unload frm Exit Sub End If On Error GoTo mylab1 检测状态转换信息或相关硬件信息代码 直到ok_reg 为真 Exit Sub mylab1: Err.Clear Call Sleep(1000*n) GoTo mylab0
lblWait.Caption = Tip
FrameWait.Visible = True
FrameWait.Refresh
End Sub Screen.MousePointer = vbHourglass
ShowWait "…生成报表中…"
....your code FrameWait.Visible = False
Screen.MousePointer = vbDefault
dim blnRunning as booleansub form_mousemove(...)
if not blnRunning then
program code
blnRunning=true
endif
end sub
'后加一句
frm.refresh
frm.show
frm.refresh
如果要调用其它的窗体,则在当中加入
load frm1
unload frm
frm1.show
即可
doevents
load frm
frm.show
gump2000(阿甘) 不用frm来提示,用frame,的方法当然是比较有新意,速度也快,但是由于是在同一FRM所以呢,在计算机执行CODE的时候,用户乱点其它钮就容易出现问题,:( ,而屏蔽按钮又增加了代码的复杂度。所以仍没有选用。不过以后一定会用的 :)
frm.Refresh
和把 把演示窗口的AutoReDraw属性设置成[True],doevents 从理论上说还是有用的,当然实际感觉不到。早一点load frm ,需要的时候 frm.Visible = True 就可以了。
问题已基本解决。谢谢各位的参与。
frm.show 1
doevents
program code
if ok_reg then unload frm '如 program code 与远程控制、或其它硬件如打印机控制等状态转换有关, 可能还需通过以下代码来unload frm Call Sleep(1000*n)
GoTo mylab0
mylab0:
if ok_reg then
unload frm
Exit Sub
End If
On Error GoTo mylab1
检测状态转换信息或相关硬件信息代码 直到ok_reg 为真
Exit Sub
mylab1:
Err.Clear
Call Sleep(1000*n)
GoTo mylab0