473,749 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Blanks vs. Nothing in a RichTextBox

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
Apr 4 '08 #1
4 1515
Define 'blank'!
"eBob.com" <eB******@total lybogus.comwrot e in message
news:eX******** ******@TK2MSFTN GP06.phx.gbl...
>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
Apr 4 '08 #2
eBob.com wrote:
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
Apr 4 '08 #3
On Apr 3, 11:16*pm, "eBob.com" <eBob....@total lybogus.comwrot e:
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]
Apr 4 '08 #4

"Stephany Young" <noone@localhos t>
Define 'blank'!
In your own standard way of replying

Not Maori?

Cor
Apr 4 '08 #5

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

Similar topics

6
6097
by: jalkadir | last post by:
I am trying to find a way to remove the leading and tailing blanks from a string. What I have come up with is not doing the work as I expected; because if the value I pass to the function is " string " the leading and trailing blanks are not removed. What am I doing wrong? trimIt( std::string s ) { size_t offset = s.length(); // Trim leading spaces ??? s.erase( 0, s.find_first_not_of( "\t\n" ) );
12
2183
by: M O J O | last post by:
Hi, If I inside a thread creates a RichTextBox and only use this inside the thread, will there be any thread problems? I need to convert between Text and RTF inside a thread. Thanks!! M O J O
2
17372
by: JonnyT | last post by:
I searched high and low for an answer on how to auto scroll a richtextbox and now I finally have it. Since it took me a while to get a good efficient way of doing it that didn't require focus to the control or the scrolltocaret method I decided that it would be worth posting to anyone who might have similar concerns. For the record this works well in an environment where you cannot have focus going to the richtextbox....such as a chat...
0
11158
by: Vincent | last post by:
Dear all, I have implemented a class to export the content of RichTextBox to image in WYSISYG mode so that line breaks on the screen are the same as exported. C# Code: public struct STRUCT_RECT
9
4878
by: James Wong | last post by:
Hi, I use the RichTextBox in my program. It will use different language in this RichTextBox (chinese and english characters), and it set the "DualFont" and use different fonts. By the way, how can I print out this content to printer easily? Thanks! James
34
4107
by: Registered User | last post by:
Hi experts, I'm trying to write a program that replaces two or more consecutive blanks in a string by a single blank. Here's what I did: #include <stdio.h> #include <string.h> #define MAX 80
3
7186
by: michael sorens | last post by:
The documentation for the RichTextBox is sketchy at best. I want to do a very simple task but I cannot find information on this. I am using a RichTextBox as an output window. Some text I want to just add plain (e.g.. rtf.Text += "new stuff..."; ) but some text, when added, I want to be in a different color or font size. Find() will not work because the text will vary. I have delimiters on it so I could recognize it with a regular ...
0
2060
by: Vimalathithan | last post by:
I just developing a editor. I have provide the options like Bold, Italic, underlin, font change, font size change. These font options are keep in with one toolstripbutton. the toolstripbar keep inside with panel. The RichTextBox keep inside with other panel. The panel height and width is same with RichTextBox. The RichTextBox both scrolling options are make it as false. I done the coding for RichTextBox's height to fit with...
1
1711
by: bmerlover | last post by:
I'm having trouble reading quotations inside the richTextBox when a file is opened on to it. I've tried a couple different methods, most of them didn't compile. I came across one that does compile and supposedly it's suppose to work but it doesn't in my case. I tried this code to see if it would recognize the quotations. For testing purpose I wanted to see if it would start the string from the quotation. str =...
0
9568
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9256
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8257
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6801
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4709
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3320
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2218
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.