【问题标题】:VB: Unhandled exception [duplicate]VB:未处理的异常[重复]
【发布时间】:2014-06-24 19:41:18
【问题描述】:

每次单击指向循环的按钮时,我的程序都会崩溃,这是它指向的代码的 sn-p:

  Public Function ExecuteCommand(ByVal filePath As String, ByVal arguments As String)     As String
        Dim p As Process
        p = New Process()
        p.StartInfo.FileName = filePath
        p.StartInfo.Arguments = arguments
        p.StartInfo.CreateNoWindow = True
        p.StartInfo.UseShellExecute = False
        p.StartInfo.RedirectStandardOutput = True
        p.Start()  // points to this line
        Return p.StandardOutput.ReadToEnd()
    End Function

错误显示“System.dll 中出现类型为 'System.ComponenetModel.Win32Exception' 的未处理异常

附加信息:系统找不到指定的文件

任何帮助将不胜感激。谢谢。

【问题讨论】:

  • 好像找不到文件。

标签: vb.net exception unhandled


【解决方案1】:

显然,作为FileName 提供的可执行文件在磁盘上不存在。

您可能想在尝试执行它之前检查它是否存在。

【讨论】:

    猜你喜欢
    • 2018-10-16
    • 1970-01-01
    • 2018-10-15
    • 1970-01-01
    • 2015-12-17
    • 2023-03-12
    • 2017-06-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多