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. clear all values from text boxes while logging out

clear all values from text boxes while logging out

Scheduled Pinned Locked Moved C#
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.
  • A Offline
    A Offline
    Ankit Aneja
    wrote on last edited by
    #1

    I have windows application when i log out from the application and login again all values are pre filled in textboxes ans list boxes i want that they get cleared when i logout

    Ankit Aneja "Nothing is impossible. The word itself says - I M possible"

    A C 2 Replies Last reply
    0
    • A Ankit Aneja

      I have windows application when i log out from the application and login again all values are pre filled in textboxes ans list boxes i want that they get cleared when i logout

      Ankit Aneja "Nothing is impossible. The word itself says - I M possible"

      A Offline
      A Offline
      Ankit Aneja
      wrote on last edited by
      #2

      do i have to reset all the textboxes or is there also some other way to do it

      Ankit Aneja "Nothing is impossible. The word itself says - I M possible"

      A 1 Reply Last reply
      0
      • A Ankit Aneja

        do i have to reset all the textboxes or is there also some other way to do it

        Ankit Aneja "Nothing is impossible. The word itself says - I M possible"

        A Offline
        A Offline
        Ankit Aneja
        wrote on last edited by
        #3

        I am doing like txtbox1.clear(); textbox2.clear(); can i do it in one go with a single function for whole form

        Ankit Aneja "Nothing is impossible. The word itself says - I M possible"

        1 Reply Last reply
        0
        • A Ankit Aneja

          I have windows application when i log out from the application and login again all values are pre filled in textboxes ans list boxes i want that they get cleared when i logout

          Ankit Aneja "Nothing is impossible. The word itself says - I M possible"

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          You can iterate over the controls collection and when you find textboxes or listboxes, clear them.

          Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

          A 1 Reply Last reply
          0
          • C Christian Graus

            You can iterate over the controls collection and when you find textboxes or listboxes, clear them.

            Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

            A Offline
            A Offline
            Ankit Aneja
            wrote on last edited by
            #5

            can u give me sample code how will i do that

            Ankit Aneja "Nothing is impossible. The word itself says - I M possible"

            M 1 Reply Last reply
            0
            • A Ankit Aneja

              can u give me sample code how will i do that

              Ankit Aneja "Nothing is impossible. The word itself says - I M possible"

              M Offline
              M Offline
              Martin 0
              wrote on last edited by
              #6

              Hello, Just use a foreach over your Controls Collection.

              foreach(Control c in this.Controls)
              {
              Label actlabel = c as Label;
              if(actlabel != null)
              {
              actlabel.Clear();
              }
              else
              {
              ListBox actlistbox = c as ListBox;
              if(actlistbox != null)
              actlistbox.Items.Clear();
              }
              }

              All the best, Martin

              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