Use .ShowDialog()
instead of .Show()
. This will make the form behave similar to a messagebox in terms of nothing else apart from the form can be clicked until the form is closed.
.ShowDialog()
also allows you to assign dialog responses to buttons on your form and then do logic based off your form response (used when making custom message boxes etc).
To reload the XML data you will need to rerun the entire of the method that loads the XML I think unless you literally just want to reload the XML file into memory. Which would be for example:
private void label5_Click(object sender, EventArgs e)
{
About LF = new About();
LF.ShowDialog();
//Written in the browser it may be slightly off
if (LD.DialogResult == DialogResult.OK)
{
smtpDetails = new XmlDocument();
smtpDetails.Load(PATH);
}
}
When running modal forms however you will need to assign the button return for the dialog, this is done using the property DialogResult
of the button. The example code is based off of the confirmation button being set to a result of "Ok".