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.

Recommended Answers

All 6 Replies

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

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.

How could SO be using the same code when DaniWeb uses custom in-house code?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.