Solved

Rich Text Box Editing

Posted on 2000-03-27
5
186 Views
Last Modified: 2010-05-02
How do I change the text in a Rich Text Box?
I want to be able to search through the RTB and use If and Then statments to manipulate strings found in it...

Here's the problem
RTB text
define names                = 10   L
define Pay                  =  6   $
bye
Daniel     $1000
Ronald      $100
Alisha      $101
Adam        $321

I want to become

names     Pay    
Daniel     $1000
Ronald      $100
Alisha      $101
Adam        $321

The "bye" in the text file means it is finished defining the field.
The number following the Define represents the number of spaces between the fields.
Sorry, if it doesn't look aligned..
This is because of the font use on this website.  There is 10 character spaces from the "n" to the "P" on the first line.
The "L" represent Left justification..
and the "$" means number which is automaticlly means it's right justified.
Some code would help out a lot.
Thanks.
0
Comment
Question by:aomega
  • 2
  • 2
5 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 100 total points
ID: 2663041
you can use the Find method to find and replace words in the rtb control.  For example:
RichTextBox1.Find ("define",0, ,rtfNoHighlight)
This will find the word 'define' without highlighting it. But I dont think this will be nearly sufficient enough for what you wish to do. Question I have:
How uniform will this be? In other words, how versatile does the code need to be?  How many fields could there be, etc.

The formatting you wish to do will be rather complex. If I find some time I will work out some code for your simple example.

   
0
 

Expert Comment

by:TheMask
ID: 2663357
Can you discuss more, please
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2663367
As your data is columnar, I think you will find a MSFlexgrid may be more suitable for your purposes. With it.. you can add pictures, and format / size cells, rows, and columns discretely
If you wanna know more.. give a shout.. <smile>.
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2664446
Gosh Azra.. a C?.. Aomega has a very tough grading curve.. particularily when you consider that you offered more assistance.. <sigh>. Oh well.. such is life.. congrats on solving the question.. <smile>.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2664948
hey I feel like I'm back in college this way   =)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now