- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
-
- namespace WindowsFormsApplication3
- {
- public partial class Form1 : Form
- {
- public static string username;
- public Form2 form2 = null; //定义窗体
- public Form1()
- {
- InitializeComponent();
- }
-
- private void Form1_Load(object sender, EventArgs e)
- {
-
- }
-
- private void button3_Click(object sender, EventArgs e)
- {
- username = "123456";
- MessageBox.Show(username);
-
- if (form2 == null) //判断窗体是否存在
- {
- form2 = new Form2();
- form2.Show();
- this.Hide();
- }
-
-
-
- }
- }
-
- }