zhcyidea(小青蛙) 谢谢
好像还是不行,提示后,程序还能启动,(出错误提示前程序并没启动)
{
MessageBox.Show("未能读取文件");
Application.Exit ();
}

解决方案 »

  1.   

    finally
    {
    Application.Exit ();
    }
      

  2.   

    楼上说的对,适当的位置加Application.Exit();
      

  3.   

    VS.Net默认的Windows启动顺序并不太容易catch运行异常。。使用VC的习惯吧。static void Main() 
    {
    try
    {
    using (CreateDevice frm = new CreateDevice())
    {
    if (!frm.InitializeGraphics()) // Initialize Direct3D
    {
    MessageBox.Show("Could not initialize Direct3D.  This tutorial will exit.");
    return;
    }
    frm.Show();
    throw new Exception("呵呵");
    // While the form is still valid, render and process messages
    while(frm.Created)
    {
    frm.Render();
    Application.DoEvents();
    }
    }
    }
    catch
    {
    MessageBox.Show("不干了:)");
    Application.Exit();
    }
    }
      

  4.   

    finally
    {
           Application.Exit ();
    }这样还得了,还让不让运行了?胡扯
      

  5.   

    MessageBox.Show("不干了:)");
    Process.GetCurrentProcess().kill();
      

  6.   

    在main{} 之后,在application.run 之前必须检测的错误,存在就不运行run是根本的方法
      

  7.   

    赞成楼上,修改Main,或者说在Main中控制程序的运行方式。