Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6983991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:29:31+00:00 2026-05-27T18:29:31+00:00

I am trying to write a text editor using RichTextBox . My concern is

  • 0

I am trying to write a text editor using RichTextBox. My concern is now about Undo and possibly Redo features of RichTextBox.

When I start writing in text box, say 1 minute! if I call Undo method, all it does is just I beleive clearing or resetting richtextbox again. How can I get it to work that it can do better, like Undoing last added word, or last added new line…I mean usual things you expect from Undo function. (The same counts for Redo also!)

Is there properties or some options to achive this? Or I have to implement my own code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:29:32+00:00Added an answer on May 27, 2026 at 6:29 pm

    You can save the lastest Data and when you want to undo you can change to now data to last data! lastest data can be set anytime that you want!

    I Make a winForm with a richTextBox and a button that button undo the wrote text:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace test
    {
    
    
    public partial class Form1 : Form
    {
        List<string> LastData = new List<string>();
    
        int undoCount = 0;
    
        public Form1()
        {
            InitializeComponent();
        }
    
        private void Form1_Load(object sender, EventArgs e)
        {
            LastData.Add(richTextBox1.Text);
        }
    
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                richTextBox1.Text = LastData[LastData.Count - undoCount - 1];
                ++undoCount;
            }
            catch { }
        }
    
        private void richTextBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            LastData.Add(richTextBox1.Text);
            undoCount = 0;
        }
    }
    }
    

    but I didn’t find any better and organized way and you can change

    LastData.Add(richTextBox1.Text);
    undoCount = 0;
    

    to save new words or new line

    update:
    if you want to save the Ram you can delete the first data on list after many undo saving.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write text to a local file (i.e. on my laptop) using
I am trying to create an XSD file in Eclipse using the text editor
I am trying to select a specified text in TinyMCE editor using JavaScript in
I'm trying to write a wysiwyg editor using a contentEditable div, and am having
I am trying to write some c# code to start a browser using Process.Start(app,args);
am trying to write text to an XML-File using the XMLSerializer. The text(String)-function escapes
I am trying to write some vertical text using MFC GDI and somehow the
My current knowledge: If you are trying to write text files in vbscript /
Summary: I'm trying to write a text string to a column of type varchar(max)
I'm trying to write a program that reads text from external file (string string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.