gonzobrains
gonzobrains

Reputation: 8036

Adding WithEvents to SerialPort object place on form in VB.NET

I have added a SerialPort object onto a form I created in a VB.NET solution. How do I add "WithEvents" to it, since I dragged it onto the form instead of creating it in code. Is it even necessary to do so?

Upvotes: 0

Views: 300

Answers (1)

J...
J...

Reputation: 31403

Dragging it onto the form automatically adds it to the designer generated code as WithEvents - it has to or you wouldn't be able to hook up events in the Events pane. If you hit the "View All Files" toggle in the Solution Explorer you should be able to see the designer files. Have a look in there and you will find where the IDE adds this code.

Upvotes: 2

Related Questions