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. saving textbox value after form closing

saving textbox value after form closing

Scheduled Pinned Locked Moved C#
csharphelpquestion
6 Posts 5 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.
  • V Offline
    V Offline
    varun_mca_ju 0
    wrote on last edited by
    #1

    i have a C# windows application form and i want that on clicking a button the value in a textBox should be incremented. for e.g. if i have entered 0 in the textBox ,every time i click the button the value in textBox should be incremented to 1,2,3,...and so on.But everytime the form runs the increment starts from 0. Is there any way to store the value contained in the textBox after the form closes and increment that value when i click the button when the form runs the next time?...Plz. Help :confused:

    M H A A 4 Replies Last reply
    0
    • V varun_mca_ju 0

      i have a C# windows application form and i want that on clicking a button the value in a textBox should be incremented. for e.g. if i have entered 0 in the textBox ,every time i click the button the value in textBox should be incremented to 1,2,3,...and so on.But everytime the form runs the increment starts from 0. Is there any way to store the value contained in the textBox after the form closes and increment that value when i click the button when the form runs the next time?...Plz. Help :confused:

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      There are many, but depends what suits you the most. Basically, you need to save this value in some persistent store( eg flat file, database, registry etc). At the form load, read this value from the sorce and display in that texbox.:rose:

      Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      1 Reply Last reply
      0
      • V varun_mca_ju 0

        i have a C# windows application form and i want that on clicking a button the value in a textBox should be incremented. for e.g. if i have entered 0 in the textBox ,every time i click the button the value in textBox should be incremented to 1,2,3,...and so on.But everytime the form runs the increment starts from 0. Is there any way to store the value contained in the textBox after the form closes and increment that value when i click the button when the form runs the next time?...Plz. Help :confused:

        H Offline
        H Offline
        hadad
        wrote on last edited by
        #3

        If you need this value only during the application running you can save it in the static Program class else if you need to read this value after closing the application you can save it in an XML file or TXT file if this value does not have a secure meaning else save it in a database or in the user system registry.

        Dad

        1 Reply Last reply
        0
        • V varun_mca_ju 0

          i have a C# windows application form and i want that on clicking a button the value in a textBox should be incremented. for e.g. if i have entered 0 in the textBox ,every time i click the button the value in textBox should be incremented to 1,2,3,...and so on.But everytime the form runs the increment starts from 0. Is there any way to store the value contained in the textBox after the form closes and increment that value when i click the button when the form runs the next time?...Plz. Help :confused:

          A Offline
          A Offline
          Ashfield
          wrote on last edited by
          #4

          This is the same question as you asked already as "incrementing using C#.Net" Didn't you liek the answers you got there? You will only get the same again.

          Bob Ashfield Consultants Ltd

          1 Reply Last reply
          0
          • V varun_mca_ju 0

            i have a C# windows application form and i want that on clicking a button the value in a textBox should be incremented. for e.g. if i have entered 0 in the textBox ,every time i click the button the value in textBox should be incremented to 1,2,3,...and so on.But everytime the form runs the increment starts from 0. Is there any way to store the value contained in the textBox after the form closes and increment that value when i click the button when the form runs the next time?...Plz. Help :confused:

            A Offline
            A Offline
            Ahsan225
            wrote on last edited by
            #5

            have u tried using static variables ?

            V 1 Reply Last reply
            0
            • A Ahsan225

              have u tried using static variables ?

              V Offline
              V Offline
              varun_mca_ju 0
              wrote on last edited by
              #6

              i'm not sure if this can be done using a static variable....can a static variable retain its last value when the page loads again? :confused:

              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