Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15214

Bizarre string concatenation issue

$
0
0
(I can't believe what I'm seeing, maybe it's just high fatigue level)

I have this code in a form:

Code:

        Function BaseString() As String
                Dim myHTML As String = ""
                myHTML = myHTML & "<iframe" & vbCr
                myHTML = myHTML & "  width=" & WBrowser.Width.ToString & vbCr
                myHTML = myHTML & "  height=" & WBrowser.Height.ToString & vbCr
                myHTML = myHTML & "  frameborder=""0"" style=""border:0"""
                Return myHTML
        End Function

When I break the code to see the return value, it is, literally, this:
Code:

" <iframe" & vbCr & " width=300" & vbCr & "  height=494" & vbCr & "  frameborder=""0"" style=""border:0"""
I wouldn't know how to do that if I tried; it's as if the code itself is showing up in the string. If I break this function out, test it separately, it works as one might expect, just concatenating the strings.

Does anyone have any idea why this might be happening? It's VS 2017, fairly straightforward form code; the larger context is that I'm trying to feed HTML into a Webbrowser control to show a location on Google Maps. Doing it naively gives me an error saying that the map piece has to be in a frame, which pushed me in this direction. None of this should be relevant to the problem, though.

I would think the problem would be *something* in the interpretation environment that has gone strange, but restarting VS didn't help. I could just be blind to the cause through fatigue, but I just don't understand this.

Viewing all articles
Browse latest Browse all 15214

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>