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

Altering ForeColor in TextBox

P: n/a
I am trying to alter the ForeColor of a TextBox object so
that parts of the displayed text are written in various
colors. For example, when writing to the TextBox I wish
to display parts of the text in red and then other parts
of the text in black. Is it possible to do this with the
TextBox object or do I need to use the RichTextBox
object? Thank you for your help!

Scott
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I beleive you can't do this with the ordinary textbox unless you are going
to implement your own drawing.

thanks,
Mohamed
--------------------
Content-Class: urn:content-classes:message
From: "Scott" <an*******@discussions.microsoft.com>
Sender: "Scott" <an*******@discussions.microsoft.com>
Subject: Altering ForeColor in TextBox
Date: Tue, 18 Nov 2003 10:09:59 -0800
Lines: 9
Message-ID: <00****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcOt/y4Id3mwhQ4FR5CVcM9oaixKMg==
Newsgroups: microsoft.public.dotnet.languages.csharp
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:200236
NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

I am trying to alter the ForeColor of a TextBox object so
that parts of the displayed text are written in various
colors. For example, when writing to the TextBox I wish
to display parts of the text in red and then other parts
of the text in black. Is it possible to do this with the
TextBox object or do I need to use the RichTextBox
object? Thank you for your help!

Scott


Nov 15 '05 #2

P: n/a
What do you mean by implementing your own drawing? Is
this very difficult to do or would you suggest using the
RichTextBox? Which method is typically used by other
developers?

Thanks,
Scott
-----Original Message-----
I beleive you can't do this with the ordinary textbox unless you are goingto implement your own drawing.

thanks,
Mohamed
--------------------
Content-Class: urn:content-classes:message
From: "Scott" <an*******@discussions.microsoft.com>
Sender: "Scott" <an*******@discussions.microsoft.com>
Subject: Altering ForeColor in TextBox
Date: Tue, 18 Nov 2003 10:09:59 -0800
Lines: 9
Message-ID: <00****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcOt/y4Id3mwhQ4FR5CVcM9oaixKMg==
Newsgroups: microsoft.public.dotnet.languages.csharp
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:200236NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

I am trying to alter the ForeColor of a TextBox object sothat parts of the displayed text are written in various
colors. For example, when writing to the TextBox I wish
to display parts of the text in red and then other parts
of the text in black. Is it possible to do this with theTextBox object or do I need to use the RichTextBox
object? Thank you for your help!

Scott


.

Nov 15 '05 #3

P: n/a
Yes, I'd use RichTextBox as it will do the job for you. what I meant by
implementing your own drawing is to subclass the normal control and write
the text yourself which may be a bit difficult...

thanks,
Mohamed

--------------------
Content-Class: urn:content-classes:message
From: "Scott" <an*******@discussions.microsoft.com>
Sender: "Scott" <an*******@discussions.microsoft.com>
References: <00****************************@phx.gbl> <RC**************@cpmsftngxa06.phx.gbl>Subject: RE: Altering ForeColor in TextBox
Date: Tue, 18 Nov 2003 11:51:58 -0800
Lines: 52
Message-ID: <00****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcOuDWzgVz2EMbg+RSCQHANllFl35A==
Newsgroups: microsoft.public.dotnet.languages.csharp
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:200267
NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

What do you mean by implementing your own drawing? Is
this very difficult to do or would you suggest using the
RichTextBox? Which method is typically used by other
developers?

Thanks,
Scott
-----Original Message-----
I beleive you can't do this with the ordinary textbox

unless you are going
to implement your own drawing.

thanks,
Mohamed
--------------------
Content-Class: urn:content-classes:message
From: "Scott" <an*******@discussions.microsoft.com>
Sender: "Scott" <an*******@discussions.microsoft.com>
Subject: Altering ForeColor in TextBox
Date: Tue, 18 Nov 2003 10:09:59 -0800
Lines: 9
Message-ID: <00****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcOt/y4Id3mwhQ4FR5CVcM9oaixKMg==
Newsgroups: microsoft.public.dotnet.languages.csharp
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gblmicrosoft.public.dotnet.languages.csharp:200236NNTP-Posting-Host: TK2MSFTNGXA13 10.40.1.165
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

I am trying to alter the ForeColor of a TextBox objectsothat parts of the displayed text are written in various
colors. For example, when writing to the TextBox I wish
to display parts of the text in red and then other parts
of the text in black. Is it possible to do this withtheTextBox object or do I need to use the RichTextBox
object? Thank you for your help!

Scott


.


Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.