473,511 Members | 16,282 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem RichTextBox

Hi, I'm new with Csharp and have an annoying problem with RichTextBox: I
cannot change the text by modifying the Rtf property from a derived class.

String sRTF = Rtf;
sRTF = sRTF.Insert(insertloc,
"{\\colortbl
;\\red128\\green0\\blue0;\\red0\\green128\\blue0;\ \red0\\green0\\blue255;}");
Rtf = sRTF;

If I print the sRTF content on the console, the ouput is exactly what
expected, with the new string in the correct position.But if I print Rtf
(that should be identical) it is as if I never modified it. Is there
something I miss about CSharp?
Thank you!
Feb 23 '07 #1
2 1743
You should use

Rtf.text = sRTF;

chanmm

"halex2000" <po*******@libero.itwrote in message
news:nr******************@twister2.libero.it...
Hi, I'm new with Csharp and have an annoying problem with RichTextBox: I
cannot change the text by modifying the Rtf property from a derived class.

String sRTF = Rtf;
sRTF = sRTF.Insert(insertloc,
"{\\colortbl
;\\red128\\green0\\blue0;\\red0\\green128\\blue0;\ \red0\\green0\\blue255;}");
Rtf = sRTF;

If I print the sRTF content on the console, the ouput is exactly what
expected, with the new string in the correct position.But if I print Rtf
(that should be identical) it is as if I never modified it. Is there
something I miss about CSharp?
Thank you!

Feb 24 '07 #2
Thank you, but Rtf is of type string, which does not contain a member 'text'
and in fact the compiler complains for this error. The documentation says
that RichTextBox.Rtf can be used for both get and set the content of the
control (not only text but also rtf tags), but I seem to be unable to modify
Rtf, doesn't matter how I try to do it :-(

"Ming Man Chan" <ch*****@hotmail.comha scritto nel messaggio
news:uL**************@TK2MSFTNGP02.phx.gbl...
You should use

Rtf.text = sRTF;

chanmm

"halex2000" <po*******@libero.itwrote in message
news:nr******************@twister2.libero.it...
>Hi, I'm new with Csharp and have an annoying problem with RichTextBox: I
cannot change the text by modifying the Rtf property from a derived
class.

String sRTF = Rtf;
sRTF = sRTF.Insert(insertloc,
"{\\colortbl
;\\red128\\green0\\blue0;\\red0\\green128\\blue0; \\red0\\green0\\blue255;}");
Rtf = sRTF;

If I print the sRTF content on the console, the ouput is exactly what
expected, with the new string in the correct position.But if I print Rtf
(that should be identical) it is as if I never modified it. Is there
something I miss about CSharp?
Thank you!


Feb 24 '07 #3

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

Similar topics

4
3455
by: John Broderick | last post by:
I've got a problem with the RichTextBox control in .Net where the garbage collector doesn't reclaim its memory after I've finished with it. My program adds a series of rtb's to the control array...
1
1580
by: Henry | last post by:
I inherited a richtextbox class and tried to add the double click even handler. Unfortunatly, when I check the properties of rtbText, it doesn't contain a double click event handler. Any ideas on...
0
3213
by: nouno | last post by:
I am trying to spell check a richtextbox. Through code (shown below) I save the contents of the richtextbox to a rtf file, open the rtf file in Word, spell check it, save it, and then load the ftf...
1
1995
by: Yuelin | last post by:
Hi, thanks Noah for your advice. I wrote following to read a rich text file into a RichTextBox control: this.m_textBox.LoadFile(openFileDialog1.FileName, RichTextBoxStreamType.RichText); ...
3
5231
by: C# | last post by:
I have a richtextbox that i am copying to an invisible richtextbox . during the keydown and keypress events i am inserting HTML tags into the invisble richtextbox along with the origional text. ...
2
17268
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...
0
2124
by: James Manila Dot Net | last post by:
I've been having a major problem using the Rtf property of the Richtextbox. I use the RTB to generate RTF code to save it in an access database. I'm successfully able to do this. However, the...
9
4841
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...
2
2547
by: drfreaky | last post by:
Hello, I want to use a richtextbox for logging status messages. I have three kind of message types and want to use different formatting for them. My problem is, I change the color, add the text...
0
1300
by: Vimalathithan | last post by:
Hi Every one, I have developing the user control with RichTextBox in C# windows application. The problem is when I paste any text inside the RichTextBox at the runtime the pasted lines not in...
0
7245
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,...
1
7085
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...
0
7512
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...
0
5671
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,...
1
5069
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...
0
4741
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...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1577
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 ...
0
449
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...

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.