473,387 Members | 1,742 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.

Newline has no effect in form fields

When I include a "\n", "\r\n" or a System.Environment.Newline in a
string value, and assign that to a form field, no newline appears at
that point in the text. I have done this in the past with a vbCrLf in
VB.Net, and as far as I know the "\r\n" should be equivalent, but it
doesn't work.

Any help would be appreciated.

Below find some sample code:

foreach(DataRow row in dt.Rows)
{
lbOutput.Text += row["Value"] + "\r\n";
}
}

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
6 1370
Check and make sure the lbOutput 'Multiline' property is enabled.

Nov 16 '05 #2
Thanks, I did try this with a text box and it works. However, I want to
do this for other form fields like a label, for which I find no
multiline property. Also I want to be able to do newlines within the
cells of a datagrid.

Does anyone know if there is a way to do this?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3
I wrote a test for label and it seems to be working. Here is the code.

label1.Text = "DBC\nUser". It prints it in 2 lines. Remember, you need
to have enough vertical space to display both lines.

Nov 17 '05 #4
I am not sure my response got posted.

I tried a label as well with the following code

label1.Text = "DBC\nUser";

it got printed in 2 lines. Only thing in this case, you have to make
sure is, you have enough veritical heights to print two lines. You do
not need to use \r, that is line feed.

Nov 17 '05 #5
Is this an ASP.NET application? If so, you'd need to write HTML into
the label, so for a line break, you'd need to insert the string "<BR/>"
"David" <an*******@devdex.com> wrote in message
news:OF**************@TK2MSFTNGP09.phx.gbl...
When I include a "\n", "\r\n" or a System.Environment.Newline in a
string value, and assign that to a form field, no newline appears at
that point in the text. I have done this in the past with a vbCrLf in
VB.Net, and as far as I know the "\r\n" should be equivalent, but it
doesn't work.

Any help would be appreciated.

Below find some sample code:

foreach(DataRow row in dt.Rows)
{
lbOutput.Text += row["Value"] + "\r\n";
}
}

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #6
Yes this is an ASP.Net application, and using the html newline code did
the trick.

Thanks a lot guys.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #7

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

Similar topics

3
by: mudge | last post by:
I'm having a problem getting rid of newlines. say I have this situation: $cat = "A nice\n cat"; The "\n" is an escape character which creates a newline right there. Now, how would I get...
6
by: The Plankmeister | last post by:
Hi.. I'm trying to achieve a newline effect within a <dt> block, but am having problems. Here is the basic code: <dl> <dt> <a href="admin_menu.html" class="small">Click here to modify the
4
by: Till Crueger | last post by:
Hi, I have a little problem with the following code: #include <stdio.h> int main(void) { char input='\0'; while(input!='q') { printf("Menu\n"); fflush(stdout);
3
by: utab | last post by:
Dear all, I have a text file in the form of 1 2 3 4 5 6 --------/--------/--------/--------/--------/--------/ (I just used / to better explain the...
1
by: utab | last post by:
Hi there I am trying to read from a file, I am trying to read certain fields,there are 6 fields in this file like --------/--------/--------/--------/--------/--------/ All fields are 8...
4
by: Peter Kirk | last post by:
Hi I would like to ask a little bit about the value Environment.Newline: what is it and what is the point of it? Ok, I can see in the docs that it represents "newline" for the current platform -...
2
by: John Salerno | last post by:
If I read a string that contains a newline character(s) into a variable, then write that variable to a file, how can I retain those newline characters so that the string remains on one line rather...
0
by: Steve K | last post by:
to this newline when an enter key is detected. Update: I tried adding this code: <code> public PMDDataGridViewTextBoxEditingControl() :base() { this.Multiline = true; } </code>
3
by: ofilha | last post by:
I am trying to export the resultset of a query to a character delimited file. I am using the wizard for this. However, one of the fields is 512 characters long and it accepts from form address. It...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.