0

I've noticed that comments in VB code snippets are ended in the middle of a line if an apostrophe is present(i.e. using a contraction), then continue from the next one over several lines until it reaches another. I'm wondering if that can't be changed to keep it as a comment right to the next newline character. The code highlighting really gets screwed up the way it is.

3
Contributors
6
Replies
50
Views
4 Years
Discussion Span
Last Post by tinstaafl
0

You can see by this that comment highglighting seems to be turned on and off by apostrophes. so that some statement are highlighted as comments and some comments are highlighted as statements, and the highlighting will even end in the middle of a line. Which seems to go against the standard Visual Studio highlighting that treats the rest of the line as a comment regardless, and the next code that doesn't have an apostrophe as a statment.

 'I wasn't sure how these 2 were declared so I made them class level and doubles
Dim grandtotal As Double = 0.0
Dim ptotal As Double = 0.0
'This will replace p1,p2,etc.
Dim p As New List(Of String)
'Add the handler to the textboxes like this, instead of using the handles clause
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    For Each tb As TextBox In Me.Controls.OfType(Of TextBox)()
        If tb.Name.Contains("txtp") Then
            AddHandler tb.TextChanged, AddressOf txtp_TextChanged
            'Instead of using separate variables for this I set up a list. Lists are used just like arrays, but you can use the add method like this when you don't know for sure how many you will get. This intializes the List so that we have an element in the list for each "txtp" textbox. At this point the values don't really matter.
            p.Add(tb.Text)
        End If
    Next
End Sub

Edited by tinstaafl

0

I just noticed a curious thing. Even though Stack OverFlow apparently uses the same code their display doesn't seem to have the same bug.

0

tinstaafl is pointing out that we both use the Prettifier open source javascript library to syntax highlight our posts.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.