I am trying to work with 2 forms. If I set the ModalResult of a button on
the 2nd form it works OK. If I try to assign the result and then return it
does not return the value I set.
1st Form (calling form)
DeliveryInfo DeliveryFrm = new
DeliveryInfo(Convert.ToInt32(this.uniqueIDTextBox. Text));
DialogResult result;
result = DeliveryFrm.ShowDialog();
if (result == DialogResult.OK)
{
MessageBox.Show("Dialog Result was OK!");
}
else if (result == DialogResult.None)
{
MessageBox.Show("Dialog Result was None!");
}
2nt Form
private void deliveryInfoOkBtn_Click(object sender, EventArgs e)
{
try
{
// code to save dialog info here!
this.deliveryInfoOkBtn.DialogResult = DialogResult.OK;
this.Hide();
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}