1.弹出登陆框,根据返回值进行处理
static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Login frm = new Login();
if (frm.ShowDialog() == DialogResult.OK)
{
Application.Run(new Main(frm.flag));
} } }
2.传值
public partial class Login : Form { public int flag = 0; public Login() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.OK; flag =1; this.Close(); } }
3.构造函数
public partial class Main : Form { public Main(int value) { InitializeComponent(); } }