你好,我想显示一个错误,如果语句的一个是假的,但我得到一个错误:错误\ example.exe“从字符串转换‘’键入”布尔“是无效”转换
If My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\EXAMPLE", "InstallLocation", "") <> "" And
My.Computer.FileSystem.FileExists(My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\EXAMPLE", "InstallLocation", "ERROR")) & "\example.exe" Then
Else
System.Threading.Thread.Sleep(1000)
example_error.ShowDialog()
End If
编辑:
Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ExecutablePath = IO.Path.Combine(CStr(My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MYAPP", "InstallLocation", "ERROR")), "myapp.exe")
If Not String.IsNullOrEmpty(CStr(My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MYAPP", "InstallLocation", ""))) _
AndAlso My.Computer.FileSystem.FileExists(ExecutablePath) Then
Else
System.Threading.Thread.Sleep(1000)
GUI_Error.ShowDialog()
End If
End Sub
“\ example.exe”是外界的存在()调用,它需要去括号内 – 2013-04-23 11:06:50
谢谢,但这并没有帮助“My.Computer.FileSystem.FileExists(My.Computer.Registry.GetValue(”HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ EXAMPLE“,”InstallLocation“,”ERROR“&”\ example.exe“))然后“ – VeilSide 2013-04-23 12:32:03