注册表项不存在,跳转错误问题
Private Sub Command1_Click()
Set BN = CreateObject( "wscript.shell ")
On Error GoTo err1
Text1(0).Text = BN.regread( "HKEY_LOCAL_MACHINE\SOFTWARE\Sonic\CinePlayer\1.5\LicenseAccepted ")
err1:
MsgBox ( "参数错误 ")
End Sub
以上是代码,运行以后不管有没有注册表项存在都会跳出错误提示。要怎么解决?能否添加一行代码检测注册表项是否存在,不存在则跳转到错误提示。
[解决办法]
Private Sub Command1_Click()
Set BN = CreateObject( "wscript.shell ")
On Error GoTo err1
Text1(0).Text = BN.regread( "HKEY_LOCAL_MACHINE\SOFTWARE\Sonic\CinePlayer\1.5\LicenseAccepted ")
exit sub
err1:
MsgBox ( "参数错误 ")
End Sub