如果在 C# 中找不到进程,如何创建错误消息?

时间:2021-04-04 06:38:16

标签: c#

这是我写的一个例子:

<div class="parent1">
  <br/>
  <br/>
  <br/>
  <br/>
  <br/>
  <br/>
  <br/>
  <div class="parent2">
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <div class="parent3">
      <br/>
      <br/>
      <br/>
      <br/>
      <br/>
      <br/>
      <br/>
      <p id="myElem">This is the element I want to get the top offset of.</p>
    </div>
  </div>
</div>
<button id="myBtn">Get top offset</button>

1 个答案:

答案 0 :(得分:1)

您可以使用 try-catch 语句来了解将出现在您的代码中的异常或错误。

try
{
    Process.Start(Proc);
}
catch(Exception ex)
{
    MessageBox.Show(ex.Message);
}
相关问题