473,387 Members | 1,603 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Textbox vs. RichTextbox + Linebreaks?

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
Mar 29 '07 #1
4 7220
Ben R. wrote:
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.

--
Larry Lard
la*******@googlemail.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version
Mar 30 '07 #2
Hi Larry,

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

-Ben

"Larry Lard" wrote:
Ben R. wrote:
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.

--
Larry Lard
la*******@googlemail.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version
Mar 30 '07 #3
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 R." wrote:
Hi Larry,

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

-Ben

"Larry Lard" wrote:
Ben R. wrote:
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.

--
Larry Lard
la*******@googlemail.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version
Mar 30 '07 #4
Ben R. wrote:
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.

--
Larry Lard
la*******@googlemail.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version
Apr 2 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Neil | last post by:
Is there an editable RTF textbox control which allows the user to apply bold, italic, etc.? I tried the Microsoft Rich Textbox Control, but there doesn't seem to be a way to allow the user to...
3
by: Scott | last post by:
I am trying to alter the ForeColor of a TextBox object so that parts of the displayed text are written in various colors. For example, when writing to the TextBox I wish to display parts of the...
2
by: nitin8or | last post by:
Hi ALL, I want to display in a RichTextBox the Binary Large Objects data coming from database. If I have one record its not a problem I convert it to byte array and pass it on in a stream as a...
2
by: Thorsten moeller | last post by:
Hi, i have a Textbox and amethod adding lines to the Textbox. There are two kind lines, depending on a check to be valid or invalid. Is it possible to color the lines or the text in a textbox...
5
by: Wilfried Mestdagh | last post by:
Hello, textBox += someData + "\r\n"; does not scroll the visible text to the end. How do I perform that ? Also this way seems to me a lot of reallocating memory. Is there better way to add...
22
by: DraguVaso | last post by:
Hi, For my application I need the following behavior: When I press F4 the cursor has to move to the next line in my multiline textbox which begins with "0". Finding lines starting with 0 isn't...
4
by: Ed | last post by:
Is there a way to convert a richt text box to a textbox? My code lloks like this Dim txtBox as System.Windows.Forms.TextBo dim richTxtBox as System.Windows.Forms.RichTextBo ...
17
by: AWW | last post by:
Using Textbox.Text = "123" & CStr(13) & "456" I expect 2 lines on the screen but get 1 line with 13 in it. It worked once in a RichTextBox but then stopped. I just want to display aligned tabular...
6
by: Tom P. | last post by:
I'm trying to make one of our perennial favorites - The Syntax Color Editor. (Mostly as a learning exercise). I'm wondering if there is a way to capture the Paint event of a textbox so I can...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.