【发布时间】:2016-08-02 17:01:04
【问题描述】:
打开我的应用程序的代码。并将参数发送到我的应用程序:
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()); ->>错误 1 'SMT_Previous_StationsChecker_Before_ICT.MainForm' 不包含采用 0 的构造函数 参数 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? -
所以另一个程序打开我的程序,并向我的程序发送一个字符串,我必须处理它,但它不起作用
-
那段代码在哪里?请参阅how to ask a question. 并使用问题上的编辑链接添加其他信息
-
这里是代码: 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", "测试");我必须在另一个应用程序中处理测试字符串
-
我编辑了这个问题,你能帮我吗?这非常重要,我将不胜感激
标签: c# parameter-passing