2010-06-22 71 views

回答

0
void mDisplayForm_Click(object sender, EventArgs e) 
    { 
     int count = 0; 
     foreach (ToolStripMenuItem template in mDisplayForms) 
     { 
      if (sender.ToString() == template.Text) 
      { 
       Process infoPath = new Process(); 
       infoPath.StartInfo.FileName = "InfoPath.exe"; 
       infoPath.StartInfo.Arguments = templates[count]; 
       infoPath.Start(); 
       count++; 
      } 
     } 
    } 

这是我用来解决该问题的代码。

+0

嗯,template.Text的检查没有语义上链接到模板[count](支持模型?)到Arguments的赋值,是吗?也许你不得不数数(但是在foreach-loop afaik中没有订单保证),无论检查是否成功。 – Andreas 2010-06-22 22:08:19

+0

嗯。实验....指数对齐。不过,我会问,因为MSDN和我看到的任何其他论坛都没有对这个主题有任何明确的答案。 – badpanda 2010-06-22 23:03:23