By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,557 Members | 1,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,557 IT Pros & Developers. It's quick & easy.

Form.AcceptButton inconsistency

P: n/a
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.

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply

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

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.