static void Main()Show Form
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());/* Chỉ Cần đổi tên là Form Khác sẽ được Load lên*/
}
+ Show 1 Form mới hoàn toàn như khởi tạo 1 class mới
Form1 f1= new Form1();+ Show 1 Form mà xem coi Form đó có Load chưa và nếu chưa exit thì hiện Form đó lên
f1.Show();
Form f1=Application.OpenForm[Form1];Hide Form
if(f1==null)
f1=new Form1();
f1.show();
Dùng hide có sẵn trong Đối tượng
code
this.Hide();/*Hide cái form đang xét/Exit Program
f1.Hide();/** hide form khởi tạo lúc nãy/
code
Application.Exit();
Form Closing
DialogResult r;Form Exit
r = MessageBox.Show("Do you really want to close","Ex1",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1);
if (r == DialogResult.No)
e.Cancel = true;
This.Close();
Note ; Focus Quay trở lại đầu Object Đã chọn thường là textbox