473,785 Members | 2,297 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.T ext = "New text" & MyRichTextBox.T ext

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

M O J O

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

If I use...

MyRichTextBox.T ext = "New text" & MyRichTextBox.T ext

... 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\ans i This is in \b bold\b0.}"
Me.Controls.Add (o)
'The line will insert the rtf where the curser is.
o.SelectedRtf = "{\rtf1\ans i 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
6558
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 Workshop program: hcw.exe that's included with Visual Basic. This exact same file compiled perfectly with no notes, warnings or errors prior to reformatting my system. Prior to the reformatting, I copied the help.rtf file onto a CD and checked the box to...
3
8252
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 way to view this file in client side without bigger downloads. Any help will be welcome, because we work more than a month in this problem. Thanks.
1
3088
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 reports. Now we´ve got the problem that there are over 500 Access report which has to be converted into rtf-documents. We tried to export the reports out of the page review into Word, but that didn´t work, because we are using Word XP or Word...
5
6320
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 desired. All this works fairly well. However, as a followup I'd like to create a report this data as a report (or booklet) in printed format. The simplest and probably least satisfactory way is to format it in very simple HTML and import it...
5
1712
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
1062
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 first RTF file only and not the appended one. But i open the file with notepad it looks appended. I've supplied my code below . I've searched thru internet a lot but didn't get anything. So if anybody hav a solution plz help me out. I'll explain...
6
6473
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, resulting in an RTF file. However, I cannot send the output back to the user in RTF, it must be sent in PDF instead, so I need to convert the result. So, what library can I use to convert from RTF to PDF ? GPL / BSD
0
1366
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 documents from HTML to RTF and RTF to HTML or XHTML. It's easy to create customizable HTML templates using merge fields, and then convert the resulting document to its RTF version for later delivery. Producing easily editable invoices or any other...
0
1266
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 single RTF document from multiple RTF controls (using MS Rich Textbox control 6.0 in Access 2000). So here's the method I came up with. Create a temporary RTF document from each control; open Word through automation; create a new doc and then...
8
6993
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 = strlen($new_rtf); $filename = "certificato_".$paz.".rtf";
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10356
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
10162
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10100
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5396
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...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4061
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
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
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.