PC Review


Reply
Thread Tools Rate Thread

Carriage Return in WinForms Label?

 
 
Cool Guy
Guest
Posts: n/a
 
      6th Sep 2005
Is it possible to insert a carriage return in a WinForms Label's Text with
the VS.NET WinForms Designer?

(Including '\n' doesn't work -- that gets converted to '\\n'.)
 
Reply With Quote
 
 
 
 
Oliver Sturm
Guest
Posts: n/a
 
      6th Sep 2005
Cool Guy wrote:

>Is it possible to insert a carriage return in a WinForms Label's Text with
>the VS.NET WinForms Designer?
>
>(Including '\n' doesn't work -- that gets converted to '\\n'.)


I think it's not possible to do this by editing the text in the property
grid. But you can (carefully!) edit the designer generated code and change
the text. One possibility is to insert \n's, like this:

this.label.Text = "Text\nSecond line";

The other is to use verbatim literals like this:

this.label.Text = @"Text
Second line";

In the latter case, be sure to break the line in the place where you want
the linebreak!

In both cases, be aware that if you change the text in the property grid
afterwards, the designer will lose your manual changes. You're fine as
long as you don't make any changes to the text.


Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a Hard Return or carriage return in an update query? Lakota2k Microsoft Access Queries 1 15th Sep 2008 05:56 AM
Search and replace hard-line-return character, not carriage return =?Utf-8?B?VHlsZXIgVA==?= Microsoft Word Document Management 2 16th Aug 2006 10:11 PM
Carriage return in label Nathan Microsoft VB .NET 4 7th Apr 2005 02:24 PM
Carriage Return and Label Microsoft Dot NET Framework Forms 0 7th Apr 2004 05:29 PM
carriage return Rulle Microsoft C# .NET 2 16th Oct 2003 01:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:49 PM.