简体   繁体   中英

c# reset a textbox.text property at runntime and reset that string to use as defaut at form opening text

In a C# Windows Forms Application I have a number of textboxes that are intended to be filled by a user at runtime. The form will be closed and the application shut down. Some time later the user restarts the application and the same form opens.

How can I close the application and then reopen it so that some of the forms textbox.text opening (default) strings are filled with the text that was entered at the previous application session?

The idea is to reduce the necessity to re-enter the same strings into the same textboxes each time the form is opened, while still have the option to change an entry when applicable and then maintain that new entry for the next session with the application.

Is it possible to make changes to a forms InitializeComponent() method code, at runtime?

can I change

this.my_textbox.Text ="something" in the forms InitializeComponent() code

to

this.my_textbox.Text ="something else"

Or how can I save the newly entered "something else" string in a file on the system and read it back from that file into mytextbox.text in the forms Load behavior event, each time the form is opened?

You can save the user-input in database and easily retrieve that data again when application is opened and load data in textboxs.

It's that easy !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM