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. Delete in Textbox

Delete in Textbox

Scheduled Pinned Locked Moved C#
4 Posts 2 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.
  • C Offline
    C Offline
    chettu
    wrote on last edited by
    #1

    Hi All Is it possible to identify the character which gets deleted when the backspace is pressed in a Textbox. Regards Deepak.S

    Y 1 Reply Last reply
    0
    • C chettu

      Hi All Is it possible to identify the character which gets deleted when the backspace is pressed in a Textbox. Regards Deepak.S

      Y Offline
      Y Offline
      Yulianto
      wrote on last edited by
      #2

      A way is to store the text in the Textbox, when ever the key is stroke. The next time key is up, compare the previous text with the current text. Another way is to catch the key down event. Check if it's a backspace, then get the last text in the current TextBox.


      Work hard and a bit of luck is the key to success.

      You don`t need to be genius, to be rich.

      C 1 Reply Last reply
      0
      • Y Yulianto

        A way is to store the text in the Textbox, when ever the key is stroke. The next time key is up, compare the previous text with the current text. Another way is to catch the key down event. Check if it's a backspace, then get the last text in the current TextBox.


        Work hard and a bit of luck is the key to success.

        You don`t need to be genius, to be rich.

        C Offline
        C Offline
        chettu
        wrote on last edited by
        #3

        Hi What u say is right when the user is going to delete the text when the cursor is at the last positon.. what if he places the cursor at some other line in the richtextbox and then do a delete.. this where i am facing the problem how will i know what is he deleting.... i gotta identify that..

        Y 1 Reply Last reply
        0
        • C chettu

          Hi What u say is right when the user is going to delete the text when the cursor is at the last positon.. what if he places the cursor at some other line in the richtextbox and then do a delete.. this where i am facing the problem how will i know what is he deleting.... i gotta identify that..

          Y Offline
          Y Offline
          Yulianto
          wrote on last edited by
          #4

          Before Delete the Text Box is before, after delete the Text Box is befre. The idea is to track this changes, compare the first char of both string, then compare the second, the the third, when you compare the fourth it's not a match, so there is a character deleted.:)


          Work hard and a bit of luck is the key to success.

          You don`t need to be genius, to be rich.

          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