打開我的應用程序的代碼。並將參數我的應用程序:從另一個應用程序獲取字符串數組
Process.Start("C:\\Users\\Laca\\Documents\\Visual Studio 2013\\Projects\\SMT_Previous_StationsChecker_Before_ICT\\SMT_Previous_StationsChecker_Before_ICT\\bin\\Debug\\SMT_Previous_StationsChecker_Before_ICT.exe", "test");
我試圖對其進行處理:
public partial class MainForm : Form
{
//public string[] ict_barcodes { get; set; }
class ParamHolder
{
public static string[] Params { get; set; }
}
public MainForm(string[] ict_barcodes)
{
InitializeComponent();
ParamHolder.Params = ict_barcodes;
}
private void MainForm_Load(object sender, EventArgs e)
{
try
{
MessageBox.Show(ParamHolder.Params[0]);
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
}
}
但沒有奏效。我收到以下錯誤:
Application.Run(new MainForm()); ->>Error 1 'SMT_Previous_StationsChecker_Before_ICT.MainForm' does not contain a constructor that takes 0 arguments C:\Users\Laca\Documents\Visual Studio 2013\Projects\SMT_Previous_StationsChecker_Before_ICT\SMT_Previous_StationsChecker_Before_ICT\Program.cs 18 29 SMT_Previous_StationsChecker_Before_ICT
任何想法?
這是一個有點不清楚是什麼你要嗎。請說明你的問題。你在哪裏創建「MainForm」? – Marusyk
因此,另一個程序打開我的程序,併發送給我的程序一個字符串,我必須處理它,多數民衆贊成但它不起作用 –
該代碼在哪裏?請參閱[如何提出問題。](http://stackoverflow.com/help/how-to-ask)並使用您問題上的編輯鏈接添加其他信息 – Marusyk