※ 引述《HsiaoM (A Better Man)》之銘言:
: 在Console Application時
: 可以用argv, argc來引入外部參數
: 在Form的程式裡面
: 要怎麼樣引入這樣的外部參數呢?
// 簡單範例
public class Form1 : System.Windows.Forms.Form
{
private string MyString;
public Form1()
{
}
public Form1(string str)
{
MyString = str;
}
}
public class MyClass
{
public static void Main(string[] args)
{
if (args.Length != 0)
Application.Run(new Form1(args[0]));
else
Application.Run(new Form1());
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.58.72.70
→
05/01 23:31, , 1F
05/01 23:31, 1F
討論串 (同標題文章)