VB,VB程序加运行参数及读取参数,获取参数方法
添加参数:
菜单-工程,打开工程属性
点击【生成】面板,在下方命令行参数中,输入要加的参数即可。
...
读取参数方法:
Private Sub Form_Load()
Dim pParam As String
Dim aParam() As String
pParam = Command & ",,,,," '添加额外空参数,避免参数为空时报错
aParam = Split(pParam, ",")
'读取参数值
xpMode = aParam(0)
xpParam1 = aParam(1)
xpParam2 = aParam(2)
xpParam3 = aParam(3)
xpParam4 = aParam(4)
'设置默认参数值
If Trim(xpMode) = "" Then
xpMode = "0"
End If
If Trim(xpParam1 ) = "" Then
xpParam1 = "255.255.255.0"
End If
End Sub
Tag: VB