Rahul Kishore
Rahul Kishore

Reputation: 380

Carriage return in TextBox concats an empty string

I'm getting a very peculiar error when I am pressing enter in my textbox... I have a simple textbox on my winform.

I press type the following text:

"This is my message! " with 2 carriage returns after it.

I'm trying to replace the carriage returns with a special tag named %new_line%..but when I go into the debug window inside VS2010 I get this!

Why is:

  vbCrlf & "" 

being added when there is no empty string after it. It's a simple carriage return with no trailing spaces.

Any workaround for this?

Upvotes: 1

Views: 62

Answers (1)

Guffa
Guffa

Reputation: 700562

That's just how the string is shown in the debug window. There are no characters after the newline.

When you have a newline in a middle of a string, it's shown as:

..." & vbCrlf & "...

There just isn't a special case for displaying the line break differently when it's at the end of a string, so you just get the & " to continue the string, and then the " to end the string.

Upvotes: 1

Related Questions