내 앱을 여는 코드. 내 응용 프로그램에 인수를 보냅니다.
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_Stations
어떤 생각?
에서 Main
의 방법 SMT_Previous_StationsChecker_Before_ICT의 응용 프로그램 당신은 같은 입력 매개 변수를 추가해야합니다 :
static void Main(string[] args)
그런 다음 해당 메서드에서이 매개 변수를 MainForm
생성자에 전달합니다.
Application.Run(new MainForm (args));
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다