473,326 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Add and remove RTF-text in a RichTextBox at runtime?

Hi,

How do I add and remove PART of the RTF-text in a RichTextBox?

If I use...

MyRichTextBox.Text = "New text" & MyRichTextBox.Text

.... then all my RTF (higlight, bold, underline and so on) is removed.
Thanks!

M O J O

Nov 20 '05 #1
2 8093
* M O J O <mojo@_no_spam_delete_this_newwebsolutions.dk> scripsit:
How do I add and remove PART of the RTF-text in a RichTextBox?

If I use...

MyRichTextBox.Text = "New text" & MyRichTextBox.Text

... then all my RTF (higlight, bold, underline and so on) is removed.


Select the text by calling the overloaded version of the control's
'Select' method and the set its 'SelectedText' property to "".

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Hi Mojo,

Thanks for posting in the community. My name is Peter, and I will be
assisting you on this issue.

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to add or remove part of
the RTF-Text in a RichTextBox.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I agree with Herfried's suggestion.
For RTF-Text you may try the SelectedRtf as below.

Dim o As New RichTextBox
o.Rtf = "{\rtf1\ansi This is in \b bold\b0.}"
Me.Controls.Add(o)
'The line will insert the rtf where the curser is.
o.SelectedRtf = "{\rtf1\ansi This is in \b bold\b0.}"
'This will remove part of the RTF-Text.
o.Select(5,7)
o.SelectedRtf = ""

For detailed information, you may take a look at the demo below.
Insert Plain Text and Images into RichTextBox at Runtime
http://www.codeproject.com/cs/miscct...ichTextBox.asp
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #3

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

Similar topics

21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
3
by: Vsoft | last post by:
We have the following problem: There is a RTF file that must be viewed on browser and we have been developed a solution in Java to do it. But the Java's VM is so bigger for download. So, we need a...
1
by: Lars | last post by:
We are using an Access 2.0 application which will be replaced by another solution. The new one is an Web-Application which is based on SQL Server 2000. This application uses rtf-documents to create...
5
by: Peter Chant | last post by:
Any thoughts in the newsgroup? Over Christmas I produced, using PHP and MySQL, a database and front end to record my familys family tree with a short biography and linked photos and locations if...
5
by: brian.lukoff | last post by:
Does anyone know of any freely usable code that helps automate the process of generating RTF files from ASP (particularly generating the code needed for tables)? Brian
0
by: amitp | last post by:
Can anyone help me out in this? I want to append multiple RTF file into one RTF file. I tried using 'streamwriter', the resulting file size becomes big and when i open it, it is the original i.e the...
6
by: leonel.gayard | last post by:
Hi, Does anyone know a good python library to convert a RTF file into PDF ? This should be done automaticaly: I have a web page that takes some values and inserts them into a RTF template,...
0
by: fblake | last post by:
Belgium (June 2007): Active Up today released the latest version of their RTF and HTML converter control for .NET, Active RTF, ActiveUp.RTF V3 ActiveUp.RTF enables any developer to convert...
0
by: Neil | last post by:
Here's a follow-up to my "Concatenating Rich Textbox Controls Into A Single File" message. I didn't get any useful responses to that message, so I assume that there isn't a direct way to create a...
8
by: Peter | last post by:
Hi all, I'm just trying to send a rtf file to the browser but firefox and IE just display raw rtf content (with tags and so on)... I used this code down below: --CODE $length =...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.