473,587 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RichTextBox.Can Undo()

I noticed what I thought was peculiar behavior when I used the RichTextBox.
If you get the RTF string from a RichTextBox using the RichTextBox.Rtf
property, the RichTextBox treats this as an action that cannot be undone.
So if you would run the following code as the TextChanged event handler of a
RichTextBox called "rtbox" ....

private void rtbox_TextChang ed(object sender, System.EventArg s e) {
Console.WriteLi ne("CanUndo 1 = " + rtbox.CanUndo);
Console.WriteLi ne("Rtf = " + rtbox.Rtf);
Console.WriteLi ne("CanUndo 2 = " + rtbox.CanUndo);
}

..... the following is always the result ....

CanUndo 1 = True
Rtf = [whatever Rtf]
CanUndo 2 = False

This makes no sense to me, and since the Text and TextLength properties of a
RichTextBox also include calls to the Rtf property, obtaining these
properties have the same effect. Initially I thought it was because a call
to the private method StreamOut(int32 ) is made, which might be considered as
writing to a stream and that might not be undoable. However, the same
method is also called in the SelectedText and SelectedRtf [GET] properties,
but the behavior does not repeat when these properties are used. Can anyone
explain why this happens?

TIA,
kruk

------------------
We've learnt that war is not the answer ... except to all of America's
problems.

Bart Simpson

Nov 13 '05 #1
0 1935

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

Similar topics

0
3223
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 file back into the ricktextbox using loadfile. The problem is that the richtextbox seems to remain bound to the rtf file. If I make a change in the richtextbox after spell checking, the changes are successfully saved to the database but if the...
11
15156
by: Mad Joe | last post by:
I'm using a richTextBox for editing a source code (with Syntax Highlighting) of my own programming language... How come that myRichTextBox doesn't respond to Undo/Redo functions by using default shortcut keys, or even programaticaly (by using Button_onClick event)? if(myRichTextBox.CanUndo == true) { myRichTextBox.Undo(); }
2
5836
by: Alan | last post by:
Hi all, I want to hilight some syntax keywords. While parsing text, I used these properties such as SelectionStart,SelectionLength and SelectionColor of RichTextBox. Although the syntaxhilghting effect was reached, I found original undo/redo function didn't work!! Any ideas? Thanks,
0
1079
by: Mathieu Girard | last post by:
Hi, I'm using VS 2005 Express C# (beta) and I'm trying to use the undo/redo feature of a RichTextBox and I just can't get it to work. myRichTextBox.Canundo is always false. I did some research about it and some people are talking about a bug in a core windows control (RichEdit). I dont know what to think anymore, all I know is that I just can't get it to work.
0
1285
by: Al Bahr | last post by:
Hi, Does anyone knows why using GetCharFromPosition(aPoint) on RichTextBox will clear the CanUndo flag? More importantly, How to use GetCharFromPosition and still be able to do Undo? Thanks Al *** Sent via Developersdex http://www.developersdex.com ***
2
17312
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
11135
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
4853
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
0
2043
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...
0
7924
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
7854
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8349
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...
0
6629
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
5722
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
5395
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
3845
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
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
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.