Textbox vs. RichTextbox + Linebreaks?

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
 
L

Larry Lard

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.
 
G

Guest

Hi Larry,

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

-Ben
 
G

Guest

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.
 
L

Larry Lard

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top