954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Visual Studio 2010 Bug :: Form Closes with No Reason

Hi,

I wasn't sure where to post this, but thought it may save some time for someone who ran into the same problem.

I had a problem in a project, where whenever I clicked the "Accept" button on a form, it would close the form for no reason.

Originally, I thought it had something to do with forms being shown as .ShowDialog and changed it to a normal .Show
This had no effect.

I copied the form into a new project and continued to experience the same problem.

Eventually after going through the Designer.vb I found the problem, which is actually a bug with VS 2010. If you set a command button as the CancelButton of the form and then set another command button afterwards as the CancelButton, VS 2010 does not remove the following line of code from the first button:

Me.cmdAccept.DialogResult = System.Windows.Forms.DialogResult.Cancel


This will most likely happen if you are double-clicking through the options for the CancelButton.

As I mentioned, I'm not sure where the correct place to post this is, so I apologize in advance if this is not the correct place.

danielgr
Light Poster
25 posts since Jun 2011
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: