Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How to close application form from another Thread in C# .NET?

application C# form thread
0
10 Posted

How to close application form from another Thread in C# .NET?

0
10

Its probalby a hacky way of doing it but off the top of my head (though there are bound to be countless examples on this site somewhere and hopefully someone will step in….) 1) I’d make one form the main one (the one that gets shown after you accept the EULA) In this form’s Load event i’d create and show the form with the eula on. 2) on the EULA form i’d assign Ok and cancel repsectively to the Dialog Result property for eachg of the two relevant buttons for accepting or declining the EULA 3) when the user clicks either button close the form and retunr to the main form, then check the dialog result, e.g private void Form1_Load(object sender, EventArgs e) { Form2 eula = new Form2(); eula.ShowDialog(); if (eula.DialogResult == DialogResult.OK) { MessageBox.Show(“Thanks for agreeing”); //do your other stuff } else Close(); } Form here i’d do my business in a separate thread using a delegate and the forms Invoke function to update a progress bar and such like then hide the main form and

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123