VS 2005: Forms Designer Clears CancelButton and AcceptButton on Compile

J

Josh Kodroff

I have a pretty standard Windows Form with 2 relevant buttons: btnOK
and btnCancel. I set both buttons' DialogResult properties
appropriately. I then set the form AcceptButton and CancelButton
properties appropriately. However, whenever I click the Play button,
the 2 properties get reset back to their defaults (nothing).

Does anyone have any idea why this might be happening? I'm
particularly annoyed because I got this right on another form and
cannot remember what I'm doing wrong.
 
O

Oenone

Josh said:
Does anyone have any idea why this might be happening?

I followed through the steps just as you described on a form in VB2005, and
it didn't behave as you stated, the DialogResult properties were left
unchanged.

Are you finding that after you stop the project and examine the button
properties in the Properties window that they have both changed? Or are the
buttons just not behaving as you expect when you click on them?
 
J

Josh Kodroff

Oenone said:
I followed through the steps just as you described on a form in VB2005, and
it didn't behave as you stated, the DialogResult properties were left
unchanged.

Are you finding that after you stop the project and examine the button
properties in the Properties window that they have both changed? Or are the
buttons just not behaving as you expect when you click on them?

Visual Studio is literally changing the AcceptButton and CancelButton
properties from the values I selected to blank. I've even tried
checking in the file to souce control, but to no avail.

My next idea is to manually write code for btnCancel that just sets the
DialogResult and hides the form, but I'm a little concerned that VS is
changing these settings without my say-so.

JK
 
J

Josh Kodroff

To answer my own question, the issue was that I was using Form.Show and
not Form.ShowDialog from the calling form. However, I am still
perplexed as to why VS was changing those properties on my behalf.

I'm not going to stay awake at night worrying about it, though.
 

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