VB,VB中关闭窗体,打开自动运行并关闭程序
VB中关闭窗体
'打开form2,然后关闭form2,只运行form2中onload中代码
Private Sub btnShowIP_Click()
Form2.Show
Unload Form2 '关闭form2
End Sub
打开自动运行并关闭程序
Private Sub Form_Load()
Dim pParam As String
Dim aParam() As String
pParam = Command & ",,,,," '添加额外空参数,避免参数为空时报错
aParam = Split(pParam, ",")
'读取参数值
xpMode = aParam(0)
'参数示例:0, p1, p2, p3, d:/111.txt
'1,是否自动运行,=1时,自动获取并设置;=0时不自动,显示窗体
'设置默认参数值
If Trim(xpMode) = "" Then
xpMode = "0"
End If
If Trim(xpMode) = "1" Then
Call btnGetSet_Click '调用按钮过程
Call btnSetNew_Click '调用按钮过程
End '运行完程序,关闭程序
End If
End Sub
Tag: VB