Cannot close dialog form by OK/Cancles buttons and Enter/Esc keys.

  • Thread starter Thread starter Ilya Evseev
  • Start date Start date
I

Ilya Evseev

Hi!
There is a dialog form containing some panels, each panel contains some buttons.
The one button have .DialogResult property assigned to OK,
and the one have .DialogResult assigned to Cancel.

Form properties .AcceptButton è .CancelButton are assigned to these two buttons.

All other buttons have .DialogResult = None.

Problem: form ignores clicks on OK è Cancel buttons, and pressing Enter and Esc.
What's happen? Where can be a bug?!?

The another form that contains OK and Cancel buttons only works properly.

WBR, Ilya
 
Ilya said:
The one button have .DialogResult property assigned to OK,
and the one have .DialogResult assigned to Cancel.

Form properties .AcceptButton & .CancelButton are assigned to these
two buttons.

I think you are mixing two different mechanisms here. It should be
enough to set the .DialogResult on the button OR the .AcceptButton
on the Form. The first case will only work when ShowDialog is used,
I don't know about the second. Also try if it makes a different
whether the button is outside the panel (directly on the Form),
although the help for .AcceptButton explicitely states that it
may be inside a container.
 
Back
Top