By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,806 Members | 1,506 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,806 IT Pros & Developers. It's quick & easy.

multiple lines in a label

P: n/a
I have a textbox that I am storing as text (or as a varChar). The field has
multiple lines in it (not wrapped).

When I read it back into a multiline textbox, it works fine. But when I
read it back into a label, it shows all lines together.

Is there a way to get the Label to display the lines separately?

I could use textbox and get rid of the border and set enable to false, but
then it greys the text, which I don't want.

Thanks,

Tom.
Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Tom,
Remember, line-breaks from a text box or text area are not the same
thing as an HTML line break. Basically you'll need to replace the linefeed
characters in the text box with the HTML <br>. This is a fairly
straightforward operation using the Replace() method of the string
functionality in .Net, such as
varChar.ToString().Replace(Environment.NewLine,"<b r>")

Hope this helps,
Mark Fitzpatrick
Microsoft MVP- FrontPage

"tshad" <ts**********@ftsolutions.com> wrote in message
news:OQ****************@tk2msftngp13.phx.gbl...
I have a textbox that I am storing as text (or as a varChar). The field
has multiple lines in it (not wrapped).

When I read it back into a multiline textbox, it works fine. But when I
read it back into a label, it shows all lines together.

Is there a way to get the Label to display the lines separately?

I could use textbox and get rid of the border and set enable to false, but
then it greys the text, which I don't want.

Thanks,

Tom.

Nov 19 '05 #2

P: n/a
"Mark Fitzpatrick" <ma******@fitzme.com> wrote in message
news:u2****************@TK2MSFTNGP11.phx.gbl...
Tom,
Remember, line-breaks from a text box or text area are not the same
thing as an HTML line break. Basically you'll need to replace the linefeed
characters in the text box with the HTML <br>. This is a fairly
straightforward operation using the Replace() method of the string
functionality in .Net, such as
varChar.ToString().Replace(Environment.NewLine,"<b r>")
Does this replace all Newlines?

Also, do I need to move the data to string or can I do it directly from
either my label control or data coming from my dataset, such as:

if not (ClientReader("achievements") is DBNull.Value) then
achievements.text = ClientReader("achievements")
achievements.ToString().replace(environment.newlin e,"<br>") ->
doesn't seem to work here
end if

or can I do it directly in the ClientReader line above?

Thanks,

Tom.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP- FrontPage

"tshad" <ts**********@ftsolutions.com> wrote in message
news:OQ****************@tk2msftngp13.phx.gbl...
I have a textbox that I am storing as text (or as a varChar). The field
has multiple lines in it (not wrapped).

When I read it back into a multiline textbox, it works fine. But when I
read it back into a label, it shows all lines together.

Is there a way to get the Label to display the lines separately?

I could use textbox and get rid of the border and set enable to false,
but then it greys the text, which I don't want.

Thanks,

Tom.


Nov 19 '05 #3

P: n/a
if not (ClientReader("achievements") is DBNull.Value) then
achievements.text =
ClientReader("achievements").ToString().replace(en vironment.newline,"<br>")
end if

-or-

if not (ClientReader("achievements") is DBNull.Value) then
achievements.text = ClientReader("achievements")
achievements.text =
achievements.text.ToString().replace(environment.n ewline,"<br>")
end if

"tshad" <ts**********@ftsolutions.com> wrote in message
news:eR**************@tk2msftngp13.phx.gbl...
"Mark Fitzpatrick" <ma******@fitzme.com> wrote in message
news:u2****************@TK2MSFTNGP11.phx.gbl...
Tom,
Remember, line-breaks from a text box or text area are not the same thing as an HTML line break. Basically you'll need to replace the linefeed characters in the text box with the HTML <br>. This is a fairly
straightforward operation using the Replace() method of the string
functionality in .Net, such as
varChar.ToString().Replace(Environment.NewLine,"<b r>")


Does this replace all Newlines?

Also, do I need to move the data to string or can I do it directly from
either my label control or data coming from my dataset, such as:

if not (ClientReader("achievements") is DBNull.Value) then
achievements.text = ClientReader("achievements")
achievements.ToString().replace(environment.newlin e,"<br>") ->
doesn't seem to work here
end if

or can I do it directly in the ClientReader line above?

Thanks,

Tom.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP- FrontPage

"tshad" <ts**********@ftsolutions.com> wrote in message
news:OQ****************@tk2msftngp13.phx.gbl...
I have a textbox that I am storing as text (or as a varChar). The field
has multiple lines in it (not wrapped).

When I read it back into a multiline textbox, it works fine. But when I read it back into a label, it shows all lines together.

Is there a way to get the Label to display the lines separately?

I could use textbox and get rid of the border and set enable to false,
but then it greys the text, which I don't want.

Thanks,

Tom.



Nov 19 '05 #4

P: n/a
"MWells" <outbound__at_sygnal.com> wrote in message
news:eb******************@tk2msftngp13.phx.gbl...
if not (ClientReader("achievements") is DBNull.Value) then
achievements.text =
ClientReader("achievements").ToString().replace(en vironment.newline,"<br>")
end if

-or-

if not (ClientReader("achievements") is DBNull.Value) then
achievements.text = ClientReader("achievements")
achievements.text =
achievements.text.ToString().replace(environment.n ewline,"<br>")
end if

Thanks - that really helps,

Tom

"tshad" <ts**********@ftsolutions.com> wrote in message
news:eR**************@tk2msftngp13.phx.gbl...
"Mark Fitzpatrick" <ma******@fitzme.com> wrote in message
news:u2****************@TK2MSFTNGP11.phx.gbl...
> Tom,
> Remember, line-breaks from a text box or text area are not the same > thing as an HTML line break. Basically you'll need to replace the linefeed > characters in the text box with the HTML <br>. This is a fairly
> straightforward operation using the Replace() method of the string
> functionality in .Net, such as
> varChar.ToString().Replace(Environment.NewLine,"<b r>")


Does this replace all Newlines?

Also, do I need to move the data to string or can I do it directly from
either my label control or data coming from my dataset, such as:

if not (ClientReader("achievements") is DBNull.Value) then
achievements.text = ClientReader("achievements")
achievements.ToString().replace(environment.newlin e,"<br>") ->
doesn't seem to work here
end if

or can I do it directly in the ClientReader line above?

Thanks,

Tom.
>
> Hope this helps,
> Mark Fitzpatrick
> Microsoft MVP- FrontPage
>
> "tshad" <ts**********@ftsolutions.com> wrote in message
> news:OQ****************@tk2msftngp13.phx.gbl...
>>I have a textbox that I am storing as text (or as a varChar). The
>>field
>>has multiple lines in it (not wrapped).
>>
>> When I read it back into a multiline textbox, it works fine. But when I >> read it back into a label, it shows all lines together.
>>
>> Is there a way to get the Label to display the lines separately?
>>
>> I could use textbox and get rid of the border and set enable to false,
>> but then it greys the text, which I don't want.
>>
>> Thanks,
>>
>> Tom.
>>
>
>



Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.