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. Visual Basic
  4. vb.net detecting changes in Textbox

vb.net detecting changes in Textbox

Scheduled Pinned Locked Moved Visual Basic
csharphelptutorialquestion
3 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.
  • D Offline
    D Offline
    DotNetNewbie
    wrote on last edited by
    #1

    Hi I have a windows application with several textboxs for input. I want my programme to be able to detect any changes in the textbox the user may make so that it will prompt the user to save the changes if they leave the form. Does any know how to do this? Is there an isdirty method or function for this? Any help is appreciated. :)

    R 1 Reply Last reply
    0
    • D DotNetNewbie

      Hi I have a windows application with several textboxs for input. I want my programme to be able to detect any changes in the textbox the user may make so that it will prompt the user to save the changes if they leave the form. Does any know how to do this? Is there an isdirty method or function for this? Any help is appreciated. :)

      R Offline
      R Offline
      Ray Cassick
      wrote on last edited by
      #2

      I usualy set a global var on the form that tracks a boolean value to signal if any of the data on the form has been changed. You can then set the value to true in any of the text boxes changed events. From here, any time you are going to close the form you check the dirty flag you have set up and see if it is true.


      Paul Watson wrote: "At the end of the day it is what you produce that counts, not how many doctorates you have on the wall." George Carlin wrote: "Don't sweat the petty things, and don't pet the sweaty things." Unknown wrote: "I love long walks, especialy taken by those that annoy me." Paraphrased from TMNT: "Cricket? You have to know what a crumpet is to understand Cricket."


      D 1 Reply Last reply
      0
      • R Ray Cassick

        I usualy set a global var on the form that tracks a boolean value to signal if any of the data on the form has been changed. You can then set the value to true in any of the text boxes changed events. From here, any time you are going to close the form you check the dirty flag you have set up and see if it is true.


        Paul Watson wrote: "At the end of the day it is what you produce that counts, not how many doctorates you have on the wall." George Carlin wrote: "Don't sweat the petty things, and don't pet the sweaty things." Unknown wrote: "I love long walks, especialy taken by those that annoy me." Paraphrased from TMNT: "Cricket? You have to know what a crumpet is to understand Cricket."


        D Offline
        D Offline
        DotNetNewbie
        wrote on last edited by
        #3

        Thanks. I have set an isdirty flag as a boolean. What i was looking for was an event for the textbox to detect the change which was the textchanged event. Everytime one of these events gets invoked, isdirty is set to true. This works for me so thank you very much for your help. :)

        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