Asp. frm that opens another Button in net
- 2021-09-04 23:57:50
- OfStack
Nonsense not much to say, directly to everyone posted code, code has comments, we have a look.
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult re = MessageBox.Show(" Are you sure about leaving "," Inquiry ",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
if(re==DialogResult.No)
{
e.Cancel = true;
}
}
private void button1_Click(object sender, EventArgs e)
{
this.Close(); // Click the button Close the window after implementation
}
private void button2_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
frm.ShowDialog(); //showdialog If you want to close the main form, You must close the modal form first
//frm.Show();// show You can click the main window again to open countless windows Without forcing you to stay in a new window
}