Board index » Visual Studio » Blanks vs. Nothing in a RichTextBox

Blanks vs. Nothing in a RichTextBox

Visual Studio84
I have a RichTextBox in which I'd like blanks to appear different from

nothing. Imagine a file which does not fill up the RTB. You can't tell how

many, if any, blanks might follow the last visible, i.e. non-whitespace,

character. I thought that I could set the BackColor of the RTB to LightGray

and then the blanks would show up as white. But instead the characters show

up on a LightGray background and the blanks, of course, show up as LightGray

spaces.



Is there a solution (which does not require a lot of graphics expertise and

code)?



Thanks, Bob


-
 

Re:Blanks vs. Nothing in a RichTextBox

Define 'blank'!





"eBob.com" <eBob.com@totallybogus.com>wrote in message

Quote
I have a RichTextBox in which I'd like blanks to appear different from

nothing. Imagine a file which does not fill up the RTB. You can't tell

how many, if any, blanks might follow the last visible, i.e.

non-whitespace, character. I thought that I could set the BackColor of the

RTB to LightGray and then the blanks would show up as white. But instead

the characters show up on a LightGray background and the blanks, of course,

show up as LightGray spaces.



Is there a solution (which does not require a lot of graphics expertise

and code)?



Thanks, Bob





-

Re:Blanks vs. Nothing in a RichTextBox

eBob.com wrote:

Quote
I have a RichTextBox in which I'd like blanks to appear different from

nothing. Imagine a file which does not fill up the RTB. You can't

tell how many, if any, blanks might follow the last visible, i.e.

non-whitespace, character. I thought that I could set the BackColor

of the RTB to LightGray and then the blanks would show up as white. But

instead the characters show up on a LightGray background and the

blanks, of course, show up as LightGray spaces.



Is there a solution (which does not require a lot of graphics

expertise and code)?



Put some text like "[End]" at the end?



Andrew





-

Re:Blanks vs. Nothing in a RichTextBox

On Apr 3, 11:16=A0pm, "eBob.com" <eBob....@totallybogus.com>wrote:

Quote
I have a RichTextBox in which I'd like blanks to appear different from

nothing. =A0Imagine a file which does not fill up the RTB. =A0You can't te=

ll how

many, if any, blanks might follow the last visible, i.e. non-whitespace,

character. =A0I thought that I could set the BackColor of the RTB to Light=

Gray

and then the blanks would show up as white. =A0But instead the characters =

show

up on a LightGray background and the blanks, of course, show up as LightGr=

ay

spaces.



Is there a solution (which does not require a lot of graphics expertise an=

d

code)?



Thanks, =A0Bob



Umm, why are you doing this?



If you are just wanting to get the user to clean up their extra blank

lines then just do it for them. A simple loop with a negitive step

through the lines property should allow you to trim off any blank

lines (not sure if calling Trim on the text will work or not).



Thanks,



Seth Rowe [MVP]

-

Re:Blanks vs. Nothing in a RichTextBox



"Stephany Young" <noone@localhost>

Quote
Define 'blank'!



In your own standard way of replying



Not Maori?



Cor





-

Re:Blanks vs. Nothing in a RichTextBox



"rowe_newsgroups" <rowe_email@yahoo.com>wrote in message

On Apr 3, 11:16 pm, "eBob.com" <eBob....@totallybogus.com>wrote:

Quote
I have a RichTextBox in which I'd like blanks to appear different from

nothing. Imagine a file which does not fill up the RTB. You can't tell how

many, if any, blanks might follow the last visible, i.e. non-whitespace,

character. I thought that I could set the BackColor of the RTB to

LightGray

and then the blanks would show up as white. But instead the characters

show

up on a LightGray background and the blanks, of course, show up as

LightGray

spaces.



Is there a solution (which does not require a lot of graphics expertise

and

code)?



Thanks, Bob



Umm, why are you doing this?



If you are just wanting to get the user to clean up their extra blank

lines then just do it for them. A simple loop with a negitive step

through the lines property should allow you to trim off any blank

lines (not sure if calling Trim on the text will work or not).



Thanks,



Seth Rowe [MVP]



I'm developing an application to assist me in the construction of regular

expressions. (I know about Expresso and I am a huge fan. But I have some

needs which go beyond its capabilities.) To develop "tight" regular

expressions I'd like to be able to distinguish between one tab character and

a few blanks.



But more generally, isn't the representation of a file in an RTB more

accurate if you can distinguish between character blanks and space where

there is no graphic for some other reason such as a tab character? (The

first program I wrote for Windows, long before .Net, displayed a file in

hexadecimal! That's how you know what's really in a file!)



In fact it was that first program which led me to believe that it would be

easy in .Net to set a background color for a font which was different from

the background color for the RTB. I didn't do exactly that since I wasn't

using an RTB but I did something similar.



If I can bring up another problem which I anticipate with RTBs, I'd like to

highlight all of the strings in a file which match a regular expression.

But it looks to me like an RTB can have only one "Selected" string. So I am

looking for a solution to this problem as well.



Thanks, Bob





-

Re:Blanks vs. Nothing in a RichTextBox



"rowe_newsgroups" <rowe_email@yahoo.com>wrote in message

On Apr 3, 11:16 pm, "eBob.com" <eBob....@totallybogus.com>wrote:

Quote
I have a RichTextBox in which I'd like blanks to appear different from

nothing. Imagine a file which does not fill up the RTB. You can't tell how

many, if any, blanks might follow the last visible, i.e. non-whitespace,

character. I thought that I could set the BackColor of the RTB to

LightGray

and then the blanks would show up as white. But instead the characters

show

up on a LightGray background and the blanks, of course, show up as

LightGray

spaces.



Is there a solution (which does not require a lot of graphics expertise

and

code)?



Thanks, Bob



Umm, why are you doing this?



If you are just wanting to get the user to clean up their extra blank

lines then just do it for them. A simple loop with a negitive step

through the lines property should allow you to trim off any blank

lines (not sure if calling Trim on the text will work or not).



Thanks,



Seth Rowe [MVP]



I'm developing an application to assist me in the construction of regular

expressions. (I know about Expresso and I am a huge fan. But I have some

needs which go beyond its capabilities.) To develop "tight" regular

expressions I'd like to be able to distinguish between one tab character and

a few blanks.



But more generally, isn't the representation of a file in an RTB more

accurate if you can distinguish between character blanks and space where

there is no graphic for some other reason such as a tab character? (The

first program I wrote for Windows, long before .Net, displayed a file in

hexadecimal! That's how you know what's really in a file!)



In fact it was that first program which led me to believe that it would be

easy in .Net to set a background color for a font which was different from

the background color for the RTB. I didn't do exactly that since I wasn't

using an RTB but I did something similar.



If I can bring up another problem which I anticipate with RTBs, I'd like to

highlight all of the strings in a file which match a regular expression.

But it looks to me like an RTB can have only one "Selected" string. So I am

looking for a solution to this problem as well.



Thanks, Bob







-