1.InstruFileName is not defined?

解决方案 »

  1.   

    change:
    private void btnInstru_Click(object sender, System.EventArgs e)
    {
        try 
        {
    int i = 0;
    for(i=0; i<4; i++)
    {
          if(InstruFileName[i].Length == 0)
    break;
    }
    if(i >= 4)
    {
    MessageBox.Show("为便于演示,一般打开指令文件数小于等于4个");
    }

    if(this.openFileDialog.ShowDialog() == DialogResult.OK )
    {
    InstruFileName[i] = this.openFileDialog.FileName;
    this.listBox1.Items.Add(InstruFileName[i] + "\n");
    }
         }
         catch (System.Exception ex)
         {
              string strEx = ex.Message;     }
    }
    看看你的提示得异常是由于什么原因引起的?
    还有,InstruFileName你是否作过初始化?第2个问题,process()
      

  2.   


    InstruFileName 在前面已经定义了啊,是个数组
      

  3.   

    1。InstruFileName 没有定义并实例化2。
                string filename="d:\\Exp.doc";
    try
    {
     
    System.Diagnostics.Process.Start(filename);                
    }
    catch(Exception er){throw er;}3。4。 没有安装 不好调试:)
      

  4.   


    mywebcom:
         processs()具体怎么用啊
         能不能给我个实例?
      

  5.   

    我觉得可能是这句有问题
    InstruFileName[i] = this.openFileDialog.FileName;
      

  6.   


    我在前面已经
       string[] InstruFileName = new string[5];
      

  7.   

    1.设断点看看哪里出错,贴出来
    2. System.Diagnostics.Process p = new System.Diagnostics.Process();
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.RedirectStandardOutput = true;
    p.StartInfo.FileName = HttpContext.Current.Request.PhysicalApplicationPath+@"\bin\auth.exe";
    // p.StartInfo.FileName = @"D:\Program Files\Internet Explorer\IExplore.exe";
    // p.StartInfo.Arguments = HttpContext.Current.Request.PhysicalApplicationPath+@"\bin\test.asp";
    p.Start();
    verifyNo = p.StandardOutput.ReadLine();
    p.Dispose();
    p.Close();
    3.4 没用过
      

  8.   

    检查一下this.openFileDialog.FileName;
    它的值为空
      

  9.   

    InstruFileName[i]这个数组没实例化吧?
      

  10.   

    想来你的程序是通过了编译的了
    是不是在下面:
    for(i=0; i<4; i++)
    {
          if(InstruFileName[i].Length == 0)
    break;
    }
    你是要找一个没有使用的InstruFileName[i]的吧,
    InstruFileName[i]是不是原来就有string类型的实例?因为在刚开始的时候,InstruFileName[i]的值为null 而不是""(空字符串)所以InstruFileName[i].Lenth等价于null.Lenth !!这是在运行时是非法的,但能通过编译
      

  11.   


    不好意思,下午去上课了,刚回来wuyeniao(巷陌·清茶): 说的很对;当时考虑用了C++里的习惯,不过后来我经过单步调试已经找出了,现在关键是第三四个问题了,忘高人能指点一二Dundas chart 不是听说很好用的嘛? 有用过的人可否指点啊?
      

  12.   

    问题肯定出现在InstruFileName[i]上面
    只要单步跟踪一下看看InstruFileName[i]是否总能指向存在的文件
      

  13.   

    前面已经定义了i.后面在for循环里面还能用吗?
      

  14.   


    我稍微改了一下判断条件久好了
    for(i=0; i<4; i++)
    {
          if(InstruFileName[i] == null)
    break;
    }