VB加载快速显示窗体问题

Dim a1 As Data
Dim a2 As Data
frmSplash.Show
a1 = Format(Time, "ss")
4 a2 = Format(Time, "ss")
If a2 - a1 <> 3 Then GoTo 4
Me.Show
Unload frmSplash
为什么我这样会错啊,提示对象变量或With快变量未设置
我把这段代码放到FORM_LOAD里面
a1 = Format(Time, "ss")这句

如果调用 Show 方法时指定的窗体没有装载,Visual Basic 将自动装载该窗体。

当 Show 在显示无模式窗体时,随后遇到的代码则要执行。当 Show 在显示模式窗体 (modal form) 时,则随后的代码直到该窗体被隐藏或卸载时才能执行。

当 Show 在显示模式窗体时,除了模式窗体中的对象之外不能进行输入(键盘或鼠标单击)。对其它窗体进行输入前程序必须隐藏或卸载模式窗体(通常是处于响应用户某些操作状态)。MDIForm 不能是形式的。

在模式窗体显示时,虽然应用程序中的其它窗体失效,但其它应用程序不会失效。

应用程序的启动窗体在其 Load 事件调用后会自动出现。

我是这样处理,
快速窗体为启动窗体,在这个窗体上打开主程序窗体
在快速窗体上加一个时间控件,设置为3秒,在事件中unlad me,完成程序的启动
温馨提示:答案为网友推荐,仅供参考
第1个回答  2008-07-08
帮你改好了,有两个地方
1.你打错字了,a1和a2的类型应该是Date,不是Data
2.a2 = Format(Time, "ss")这句前面要加一句DoEvents,否则那个窗体显示不出来

如果你是想做欢迎窗体的话,建议你看一下我在这个帖子的回答
http://zhidao.baidu.com/question/59415019.html
比你的这种方法要好一点

Dim a1 As Date
Dim a2 As Date
frmSplash.Show
a1 = Format(Time, "ss")
4:
DoEvents
a2 = Format(Time, "ss")
If a2 - a1 <> 3 Then GoTo 4
Me.Show
Unload frmSplash本回答被提问者采纳
第2个回答  2008-07-08
Dim a1 As string
Dim a2 As string
数据类型错了。
最好加上DOEVENTS
Private Sub Form_Load()
Dim a1 As String
Dim a2 As String
frmSplash.Show
a1 = Format(Time, "ss")
4 a2 = Format(Time, "ss")
DoEvents
If a2 - a1 <> 3 Then GoTo 4
Me.Show
Unload frmSplash
End Sub
第3个回答  2008-07-08
Dim a1 As Data
Dim a2 As Data
frmSplash.Show
a1 = Format(Time, "ss")
4 a2 = Format(Time, "ss") ''''这一句出错吧?
If a2 - a1 <> 3 Then GoTo 4
Me.Show
Unload frmSplash