Visual Basic dot NET – Making a button the form default

Here is a quick tip for any and all of you VB slimming pills that work.NET heads out there.  Need to make a button on your form the default one to fire off when you hit the enter key (while that form has focus naturally)?  In the old days, it was a button property, and now it has become a form property.  It actually kind of makes sense when you think about it.  I mean, you can only have one default button on a form, right?  Anyway, go to the properties of the form in question and look for an option called “AcceptButton”.  This will be a drop down list comprised of all the buttons that have been placed on the form.  Pick the one you want as the default and there you have it, your button is ready to go!  Hope that helps …

Leave a Reply

Your email address will not be published. Required fields are marked *