ClickOnce creates defect runtime code C sharp Top Online Courses From ProgrammingKnowledge Python Programming Course …



  1. private void Form_Main_FormClosing(object sender, FormClosingEventArgs e)
    DialogResult result = MessageBox.Show("EXIT?", "Exit Program", MessageBoxButtons.YesNo);

    if (result != DialogResult.Yes)
    e.Cancel = true;

  2. guys i am having problem when saving my c# application it is giving error of some kind i have to make project and have to save it to later connect to mysql i don"t know what to do??

  3. just get rid of the first IF for the YES option 🙂 …if you then save it and click on yes it closes the application anyways, and the NO option works as intended… hope it helps its the easiest way…

  4. sorry guys… I already solve the e.Cancel error and is now OK… I did mistake of putting the code in the different procedures… my bad… thanks ProgrammingKnowledge for this code….

  5. There in your tutorial Form1 – .Hide and it is in RAM. WHen you close 2nd form – programm asks 2 times for closing – 1st time for Form2 and second time for Form1. How can i "kill" form1 and get only 1 message "Are you sure want to exit" instead of 2?

  6. Just remove the else and keep the if and the code will work just fine..

         DialogResult form1 = MessageBox.Show("Do you really want to close the program?",
                    "Exit", MessageBoxButtons.YesNo);

                if (form1 == DialogResult.Yes)

    This worked for me!

  7. How would you make this a class so that if your application had multiple forms you could reuse the same code rather than wasting a lot of time repeating the code in each form?  Thanks


Please enter your comment!
Please enter your name here