Textbox vs. RichTextbox + Linebreaks?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I've got a webservice that just returns a string, and in the middle of the
string, I use a controlchars.newline. When I set this string to the text
property of a textbox, it shows up as one line, with the newline just
appearing as a square. If I do the same with a richtextbox, it looks correct.
Do the two handle UTF-8 strings differently?

-Ben
 
Ben said:
Hi,

I've got a webservice that just returns a string, and in the middle of the
string, I use a controlchars.newline. When I set this string to the text
property of a textbox, it shows up as one line, with the newline just
appearing as a square. If I do the same with a richtextbox, it looks correct.
Do the two handle UTF-8 strings differently?

If you want a TextBox to display multiple lines you need to set its
Multiline property to true.
 
Hi Larry,

I've already tried this. The string still shows with a box in place of a
linebreak...

-Ben
 
Just to further clarify, if I use:

TextBox1.Text = "test" & ControlChars.NewLine & "string"

in the form_load event, it works properly. But if I use:

Dim x As New com.ibm.machine.Service
TextBox1.Text = x.HelloWorld()

and have the helloworld method defined remotely as:

return "test" & ControlChars.NewLine & "string"

This causes the textbox1 to look like:

Hello World(BOX)string

However, if I do:
Dim x As New com.domain.machine.Service
RichTextBox1.Text = x.HelloWorld()

It looks correct with a line break.
 
Ben said:
Just to further clarify, if I use:

TextBox1.Text = "test" & ControlChars.NewLine & "string"

in the form_load event, it works properly. But if I use:

Dim x As New com.ibm.machine.Service
TextBox1.Text = x.HelloWorld()

and have the helloworld method defined remotely as:

return "test" & ControlChars.NewLine & "string"

This causes the textbox1 to look like:

Hello World(BOX)string

However, if I do:
Dim x As New com.domain.machine.Service
RichTextBox1.Text = x.HelloWorld()

It looks correct with a line break.

OK, so make a little helper function that takes an array of Char and
returns the ToString of the numeric values of the elements, then compare
its output when passed the test string and x.HelloWorld(). Maybe the
newline is different on the remote system, maybe it's getting
mistranslated on the wire.
 
Back
Top