Form.AcceptButton inconsistency

J

Jeff

Hello all.

I'm trying to figure out exactly what is going on here. I'm getting
different results on different forms, and it's driving me nuts.

For example, I have a form called FormFinish. It's AcceptButton is set
to btnExport and the CancelButton is set to btnCancel.

btnExport on FormFinish has no event code whatsoever (not even for
click.) When the user either clicks the button or presses enter on the
form, it is closed and the DialogResult property is set to
DialogResult.OK automatically.

I have another form with an AcceptButton and a CancelButton. Neither of
these buttons have code for the click events either. (The only code that
even exists for this form is to change the Text of a label, and the
generated code) Pressing escape or clicking cancel will close the form,
as it does on the other. This is not the case for the AcceptButton. If I
add DialogResult = DialogResult.OK to the AcceptButton's click event,
then it does close.

So why does one form not require any code for the click event for the
button designated as the AcceptButton, yet the other form does require
it? I'm really confused here.

Thanks,
Jeff
 
J

Jeff

Nevermind! I just realized I had set the DialogResult property on one of
the buttons, but not the other. Duh.

Jeff
 

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