473,403 Members | 2,293 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,403 software developers and data experts.

Breaks in labels

I am writing some text in a multiline text box to a database . When I
display this in a label all the breaks have disappeared. I will be using
formviews a lot so I need a solution that works with bound data. In ASP I
used to use the replace function to replace chr(13) with "<br>". I am not
sure the how to do this in .net. Is there some simple setting or do I have
create my own version of a label and overide an event. I am a little unsure
of how to do this. Regards, Chris.
Jun 3 '07 #1
4 1390
"Chris" <no****@nospam.comwrote in message
news:Oo**************@TK2MSFTNGP06.phx.gbl...
>I am writing some text in a multiline text box to a database . When I
display this in a label all the breaks have disappeared. I will be using
formviews a lot so I need a solution that works with bound data. In ASP I
used to use the replace function to replace chr(13) with "<br>". I am not
sure the how to do this in .net. Is there some simple setting or do I have
create my own version of a label and overide an event. I am a little unsure
of how to do this. Regards, Chris.

string strText = "This is a multiline label\\r\\nwith a line break";
MyLabel.Text = strText.Replace(\\r\\n, "<br />");
--
http://www.markrae.net

Jun 3 '07 #2
Is there any way of building a composite control and overiding its databound
(I'm guessing the event name) so I can use the label without do the code all
the time? Bear in mind I am quite new the .net. Regards, Chris.

"Mark Rae" <ma**@markNOSPAMrae.netwrote in message
news:OM**************@TK2MSFTNGP02.phx.gbl...
"Chris" <no****@nospam.comwrote in message
news:Oo**************@TK2MSFTNGP06.phx.gbl...
>>I am writing some text in a multiline text box to a database . When I
display this in a label all the breaks have disappeared. I will be using
formviews a lot so I need a solution that works with bound data. In ASP I
used to use the replace function to replace chr(13) with "<br>". I am not
sure the how to do this in .net. Is there some simple setting or do I have
create my own version of a label and overide an event. I am a little
unsure of how to do this. Regards, Chris.


string strText = "This is a multiline label\\r\\nwith a line break";
MyLabel.Text = strText.Replace(\\r\\n, "<br />");
--
http://www.markrae.net

Jun 3 '07 #3
"Chris" <no****@nospam.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Is there any way of building a composite control and overiding its
databound (I'm guessing the event name) so I can use the label without do
the code all the time? Bear in mind I am quite new the .net.
You could build a control if you wanted to, but I can't really see that it
would save you any time and/or code...

However, it might be worthwhile as a learning exercise:
http://www.google.co.uk/search?sourc...ite+control%22
--
http://www.markrae.net

Jun 3 '07 #4
your own control is a good solution and pretty simple:
public class MultiLineLabel : Label
{
override string Text
{
get {return base.Text;}
set {base.Text = value.Replace("\\r\\n","<br />"); }
}
}
-- bruce (sqlwork.com)

Chris wrote:
Is there any way of building a composite control and overiding its databound
(I'm guessing the event name) so I can use the label without do the code all
the time? Bear in mind I am quite new the .net. Regards, Chris.

"Mark Rae" <ma**@markNOSPAMrae.netwrote in message
news:OM**************@TK2MSFTNGP02.phx.gbl...
>"Chris" <no****@nospam.comwrote in message
news:Oo**************@TK2MSFTNGP06.phx.gbl...
>>I am writing some text in a multiline text box to a database . When I
display this in a label all the breaks have disappeared. I will be using
formviews a lot so I need a solution that works with bound data. In ASP I
used to use the replace function to replace chr(13) with "<br>". I am not
sure the how to do this in .net. Is there some simple setting or do I have
create my own version of a label and overide an event. I am a little
unsure of how to do this. Regards, Chris.

string strText = "This is a multiline label\\r\\nwith a line break";
MyLabel.Text = strText.Replace(\\r\\n, "<br />");
--
http://www.markrae.net

Jun 4 '07 #5

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

Similar topics

2
by: Martin O'Rourke | last post by:
All, I am hoping someone might be able to put me out of my misery and let me know if it is possible or not to dervie the name of an element in a form, based on its associated label, only knowing...
2
by: DBQueen | last post by:
I have a database which will be printing out labels for SMALL test tubes (1/4" high). We have yet to find a reasonably-priced printer (labelwriter) which can effectively print this on ROLLS of...
6
by: DebbieG | last post by:
I am creating a database for a small department in a university. Each student in their database can have 2 mailing addresses. They wanted mailing labels pulling just the 1st address. No problem....
3
by: Grim Reaper | last post by:
I print mailing labels out of Access 2000 databases about 3 to 4 times a week. I have been having problems with one thing since I have been printing mailing labels. I print mailing labels by...
3
by: Grim Reaper | last post by:
I know this is probably an easy question, but I could not find/figure it out. Basically, I am printing mailing labels with a "Sorting/Grouping" section that groups the label types together....
2
by: John Smith | last post by:
Perhaps the wrong place to ask but...Friend has names and addresses in Microsoft Works Database...how can she print off address labels from this database? Thanks, John
10
by: Evie | last post by:
I understand that when a switch statement is used without breaks, the code continues executing even after a matching case is found. Why, though, are subsequent cases not evaluated? I wrote a...
6
by: Ron | last post by:
Hi, I know Access allows for easy construction of a report setup to print labels from a table/query, etc. I've done that one. It works pretty well for what I need. However, is there an...
0
by: xikom01 | last post by:
In this age, there is a lot of focus on the importance of "getting organized." There are even professional organizers for hire! Labels are a huge presence in the field of organization, because they...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.