momentary switch with Visual Basic

but can't import into visual Studio 2010 Express

Why can't you?

Of course, the posted code is only the code behind the form definition code, which was not posted.

You need to define a form with a button on it, called Button1. Then, select the button and look at the properties. At the top of the properties tab, there is a lightening bolt that shows events. Double click in the field next to the MouseDown event. The handler will be created, and you will be switched to the code behind page. Switch back to the form tab, and do the same for the MouseUp event.

Then, switch back to the form view, and double click on the form to add the Load event handler.

Copy and paste the code into the stubs.

Don't forget to add a SerialPort object to the form.