NormD
NormD

Reputation: 549

Visual Studio loses/drops/deletes VB continuation lines after subroutines?

Several times while debugging a VB.Net program I have found that continuation lines are missing from a subroutine designed to handle an event. The continuation character "_" is there but the following line is missing

Example:

Friend Sub TV_Main_Network_MouseDown _
    Handles TV_Main_Network.MouseDown

Will become

Friend Sub TV_Main_Network_MouseDown _

The first few times I figured I had made some editing error, but this has happened 3 times now, always in the same way (different subroutines but same place). As far as I can tell, no other continuation lines have changed.

Is this a bug or some feature I have missed?

Upvotes: 1

Views: 157

Answers (1)

xpda
xpda

Reputation: 15813

This happens if you delete a control that the handler is based on. For example, if you have a handler for button1 and delete button1 from the form (in design mode), the "handles" part of the sub statement is automatically deleted.

This also happens when you write a handler for a control that does not exist, then add the control to the form in design mode, and then double click on that control. In this case, it adds a new handler and removes the "handles..." from the previous handler.

Upvotes: 2

Related Questions