I made a form to be a dialog and the form only has one textbox, one OK button and one Cancel button. somehow, when the following does not work unless i change rnmForm.DialogResult!=DialogResult.OK), why is that????
frmRename rnmForm = new frmRename();
rnmForm.ShowDialog(new Form());
if (rnmForm.DialogResult==DialogResult.OK)
{
MessageBox.Show("test");
}
Did you make sure to set the dialog result to OK, before you close the dialog in the Ok click event?
Or setting the property on the Ok button, similar to this:
I also have to ask why you are calling showDialog and specifying a new instance of your form to be the owner, instead of just calling it with no parameters. Just not sure that was intentional.