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. Is there a method to change a text box back to it's original state?

Is there a method to change a text box back to it's original state?

Scheduled Pinned Locked Moved C#
questioncsharptutorial
6 Posts 3 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.
  • H Offline
    H Offline
    humblepgmr
    wrote on last edited by
    #1

    I'm programming in C# but I thought this would be a VB question i'm not sure how to do this, but assume I've got a text box that has a properties. The properties dynamically change throughout the program, upon request, is there a method through system way to get the text box (or any checkbox, radio button group, label etc.) to change back to its original state?

    D L 2 Replies Last reply
    0
    • H humblepgmr

      I'm programming in C# but I thought this would be a VB question i'm not sure how to do this, but assume I've got a text box that has a properties. The properties dynamically change throughout the program, upon request, is there a method through system way to get the text box (or any checkbox, radio button group, label etc.) to change back to its original state?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      No. The controls do not keep a record of their initial state are application startup. You have to write a method that will reset all the properties of a control to a state that you want. Call this method when you want to reset the textbox.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      1 Reply Last reply
      0
      • H humblepgmr

        I'm programming in C# but I thought this would be a VB question i'm not sure how to do this, but assume I've got a text box that has a properties. The properties dynamically change throughout the program, upon request, is there a method through system way to get the text box (or any checkbox, radio button group, label etc.) to change back to its original state?

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        Hi, alternatively you can hide the original Control, then call an "init" method, which clones the Control, adds it to its parents.Controls and makes it visible. When you want the original back, remove the Clone, and call "init" again. So it is always a clone that is shown, gets modified, and the original is never touched. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google


        D 1 Reply Last reply
        0
        • L Luc Pattyn

          Hi, alternatively you can hide the original Control, then call an "init" method, which clones the Control, adds it to its parents.Controls and makes it visible. When you want the original back, remove the Clone, and call "init" again. So it is always a clone that is shown, gets modified, and the original is never touched. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google


          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Though I've never had to reset controls back to a known state, (I tend to destroy and create entire forms instead) that's a trick I'll have to put in the bag.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          L 1 Reply Last reply
          0
          • D Dave Kreskowiak

            Though I've never had to reset controls back to a known state, (I tend to destroy and create entire forms instead) that's a trick I'll have to put in the bag.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            I made sure my bag of tricks is an ArrayList, so it accepts all kinds of objects, and is only limited by total amount of memory available. :-D Come to think of it, it more resembles a Heap, difficult to enumerate...

            Luc Pattyn [Forum Guidelines] [My Articles]


            this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google


            D 1 Reply Last reply
            0
            • L Luc Pattyn

              I made sure my bag of tricks is an ArrayList, so it accepts all kinds of objects, and is only limited by total amount of memory available. :-D Come to think of it, it more resembles a Heap, difficult to enumerate...

              Luc Pattyn [Forum Guidelines] [My Articles]


              this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google


              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Yeah, same with mine. Well, not really a digital heap, but a huge pile of sticky notes. :-D

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007

              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