markup in TextBox?
Messages   Related Types
This message was discovered on ASPFriends.com 'winforms-cs' list.


Edward Tanguay
How can I format/markup text added to a TextBox?

e.g. how do I make this text bold:

textBox1.Text += "<b>Executable path of application</b>: " +
Application.ExecutablePath + "'\r\n";

Or how does one markup programatically in WinForms as in WebForms, if I am
creating reports with an unknown length that I want to have formatted nicely
and have the user be able to scroll (e.g. not a Label)?

Thanks,

Edward Tanguay
www.tanguay.de

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

Reply to this message...
 
    
Jason Sellers
Have you looked at using a RichTextBox? Works well for this sort of
thing. You can do formatting and there's even a nice SaveFile() method.

This should do the trick for your example:

richTextBox1.SelectionFont =3D new Font(richTextBox1.Font,
FontStyle.Bold);
richTextBox1.AppendText("Executable path of application");
richTextBox1.AppendText(": " + Application.ExecutablePath + "'\r\n");

jason

-----Original Message-----
From: Edward Tanguay [mailto:Click here to reveal e-mail address]=20
Sent: Friday, May 10, 2002 6:44 AM
To: winforms-cs
Subject: [winforms-cs] markup in TextBox?

How can I format/markup text added to a TextBox?

e.g. how do I make this text bold:

textBox1.Text +=3D "<b>Executable path of application</b>: " +=20
Application.ExecutablePath + "'\r\n";

Or how does one markup programatically in WinForms as in WebForms, if I
am=20
creating reports with an unknown length that I want to have formatted
nicely=20
and have the user be able to scroll (e.g. not a Label)?

Thanks,

Edward Tanguay
www.tanguay.de

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

| [winforms-cs] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.asplists.com/asplists/winforms-cs.asp =3D JOIN/QUIT

Reply to this message...
 
 
System.Drawing.Font
System.Drawing.FontStyle
System.Web.UI.MobileControls.TextBox
System.Web.UI.WebControls.TextBox
System.Windows.Forms.Application
System.Windows.Forms.RichTextBox
System.Windows.Forms.TextBox




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com