G
Guest
I have a modal form (ShowDialog()) that I may want to close when a user
clicks a button. I already have an OK and Cancel button, so I can't use
those options, but I want it to function just like an OK button press. See
Example:
private void add_Click(object sender, EventArgs e)
{
// Do some work...
if (itemcnt == 0)
{
this.DialogResult = DialogResult.Cancel;
// Close current form and return.
}
}
clicks a button. I already have an OK and Cancel button, so I can't use
those options, but I want it to function just like an OK button press. See
Example:
private void add_Click(object sender, EventArgs e)
{
// Do some work...
if (itemcnt == 0)
{
this.DialogResult = DialogResult.Cancel;
// Close current form and return.
}
}