Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Undo() Method?

Undo() Method?

Scheduled Pinned Locked Moved C#
question
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Wolf92
    wrote on last edited by
    #1

    Hi, I am building a text editor, and I would like to undo the last thing done. so, I used the Undo() method, but found it undoes everything changed, how can I set it so it only changes the LAST thing done? My code was: rchTextCode.Undo();

    S S S 3 Replies Last reply
    0
    • W Wolf92

      Hi, I am building a text editor, and I would like to undo the last thing done. so, I used the Undo() method, but found it undoes everything changed, how can I set it so it only changes the LAST thing done? My code was: rchTextCode.Undo();

      S Offline
      S Offline
      sharpiesharpie
      wrote on last edited by
      #2

      Err..i haven't realy tested it but how about....rchTextCode.Text.Undo()? of cource it'll delete everything if u tell it to undo the entire textbox and not the text it in...

      S 1 Reply Last reply
      0
      • W Wolf92

        Hi, I am building a text editor, and I would like to undo the last thing done. so, I used the Undo() method, but found it undoes everything changed, how can I set it so it only changes the LAST thing done? My code was: rchTextCode.Undo();

        S Offline
        S Offline
        Stefan Troschuetz
        wrote on last edited by
        #3

        Search the articles for "undo". There are some that cover this topic.


        "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

        www.troschuetz.de

        1 Reply Last reply
        0
        • S sharpiesharpie

          Err..i haven't realy tested it but how about....rchTextCode.Text.Undo()? of cource it'll delete everything if u tell it to undo the entire textbox and not the text it in...

          S Offline
          S Offline
          Stefan Troschuetz
          wrote on last edited by
          #4

          sharpiesharpie wrote:

          Err..i haven't realy tested it but how about....rchTextCode.Text.Undo()?

          This won't work as the String class defines no Undo method.

          sharpiesharpie wrote:

          of cource it'll delete everything if u tell it to undo the entire textbox and not the text it in...

          The Undo method only operates on the text of the text box (see the documentation). He meant that it undos all changes applied to the text and not all changes applied to the text box itself.


          "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

          www.troschuetz.de

          S 1 Reply Last reply
          0
          • S Stefan Troschuetz

            sharpiesharpie wrote:

            Err..i haven't realy tested it but how about....rchTextCode.Text.Undo()?

            This won't work as the String class defines no Undo method.

            sharpiesharpie wrote:

            of cource it'll delete everything if u tell it to undo the entire textbox and not the text it in...

            The Undo method only operates on the text of the text box (see the documentation). He meant that it undos all changes applied to the text and not all changes applied to the text box itself.


            "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

            www.troschuetz.de

            S Offline
            S Offline
            sharpiesharpie
            wrote on last edited by
            #5

            Actually, there is a rtf.Text.Undo method...

            S 1 Reply Last reply
            0
            • W Wolf92

              Hi, I am building a text editor, and I would like to undo the last thing done. so, I used the Undo() method, but found it undoes everything changed, how can I set it so it only changes the LAST thing done? My code was: rchTextCode.Undo();

              S Offline
              S Offline
              ShermansLagoon
              wrote on last edited by
              #6

              I tried and got the Undo() not to undo the whole textbox, but only the latest entry. What I did was I clicked on another object, then clicked on the textbox and added more text. You can probably achieve multi-stepped undo by playing a bit with the TextChanged event from the RichTextBox and changing focus.

              Internet - the worlds biggest dictionary

              1 Reply Last reply
              0
              • S sharpiesharpie

                Actually, there is a rtf.Text.Undo method...

                S Offline
                S Offline
                Stefan Troschuetz
                wrote on last edited by
                #7

                Mmh, I don't know where you get that.? The RichTextBox.Text property returns a String instance and the String type definitely has no Undo method.


                "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

                www.troschuetz.de

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups