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