Form1.cs
上传用户:linger1010
上传日期:2008-12-08
资源大小:561k
文件大小:1k
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- namespace DataTransport
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- string m_userName = null;
- private void m_btnLogin_Click_1(object sender, EventArgs e)
- {
- Form2 f = new Form2("guest");
- DialogResult r = f.ShowDialog();
- if(r == DialogResult.OK)
- m_lblMessage.Text = "Welcome!";
- else
- m_lblMessage.Text = "Please Login...";
- }
- private void m_btnLogin_Click_2(object sender, EventArgs e)
- {
- Form2 f = new Form2("guest");
- f.UserName = m_userName;
- DialogResult r = f.ShowDialog();
- if(r == DialogResult.OK)
- {
- m_userName = f.UserName;
- m_lblMessage.Text = String.Format("Hello, {0}!", f.UserName);
- }
- else
- m_lblMessage.Text = "Please Login...";
- }
- private void m_btnLogin_Click_3(object sender, EventArgs e)
- {
- Form2 f = new Form2("guest");
- f.Login += new Form2.LoginEventHandler(f_Login);
- f.ShowDialog();
- }
- void f_Login(object sender, Form2.LoginEventArgs e)
- {
- m_userName = e.UserName;
- m_lblMessage.Text = String.Format("Hello, {0}!", e.UserName);
- }
- }
- }