2016-08-02 6 views
0

私のアプリを開くコードです。そして自分のアプリケーションに引数を送信します。別のアプリケーションから文字列を取得

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); } 

    } 
} 

しかし、それは動作しませんでした:

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"); 

私はそれを処理しようとしました。次のエラーが表示されます。

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

ご存じですか?あなたは次のように入力パラメータを追加する必要が

+0

に、このパラメータを渡す

static void Main(string[] args) 

を何欲しいですか。問題を明記してください。 'MainForm'はどこで作成しますか? – Marusyk

+0

別のプログラムが私のプログラムを開いてプログラムに文字列を送り、それを処理する必要がありますが、それは動作しません。 –

+0

そして、そのコードはどこですか? [質問する方法](http://stackoverflow.com/help/how-to-ask)を参照し、質問の編集リンクを使用して追加情報を追加してください – Marusyk

答えて

0

SMT_Previous_StationsChecker_Before_ICTアプリケーションのMain方法では:それは少し不明だし、その方法でMainFormコンストラクタ

Application.Run(new MainForm (args)); 
+0

ありがとうございました –

+0

助けてくれてうれしい – Marusyk

関連する問題