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

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
 
?

=?ISO-8859-1?Q?Christian_Fr=F6schlin?=

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top