I have a program that has multiple text boxes, i need it to save the text that is put in the textbox automatically when the program is closed.. I couldnt find a solution anywhere! Hopefully i can find some help <3
|
C#
How do i save the text in a textbox? |
(Jan 16, 2017 03:08 PM)Annabelle Lee Wrote: What language is this program written in? Typically you'll get the value of the textbox and save it to a file when the program exit functions are called, so it saves, then exits. Im so confused, i need some help :/ (Jan 16, 2017 03:18 PM)Mqson Wrote: Im so confused, i need some help :/ We need to know what language the program is being written in before we can even begin to help you. (Jan 16, 2017 03:18 PM)Mqson Wrote: Im so confused, i need some help :/ Answer the above question.
Jan 16, 2017 03:20 PM
(This post was last modified: Jan 16, 2017 03:24 PM by Mqson.)
(Jan 16, 2017 03:20 PM)Gt403cyl Wrote: Answer the above question.Its in c# Using vb 2015 This is what i have so far, im completely new to this gyazo.com/fc3dddef53522c53a525ae7114e9e723 gyazo.com/c50c9823a1091165c4483446fc0454d9
Jan 16, 2017 03:26 PM
(This post was last modified: Jan 16, 2017 03:32 PM by Annabelle Lee.)
Might want to read through this then: https://msdn.microsoft.com/en-us/library...s.80).aspx
It's a nice way to go about it. Edit: Looking over your code, can you show if you actually MADE the settings? And if so you would simply do something like this: Code Properties.Settings.Default.text1 = Textbox1.text; (Basically something like this)text1 is what I simply assume you're calling your premade property, though it might have a different name. (Jan 16, 2017 03:42 PM)Gt403cyl Wrote: What did you name the textbox? What do you mean (Jan 16, 2017 03:46 PM)Mqson Wrote: What do you mean In order to save the contents of the text box you have to have the textbox. What is the name property of the textbox? (Jan 16, 2017 03:50 PM)Gt403cyl Wrote: In order to save the contents of the text box you have to have the textbox. Do you have teamviewer? lol (Jan 16, 2017 03:53 PM)Mqson Wrote: Do you have teamviewer? lol Yes but I'm not at home so I can't. I think you need to take some more time reading before you start making projects. Have a read here. https://hackforums.net/showthread.php?tid=5176588 (Jan 16, 2017 02:28 PM)Mqson Wrote: I have a program that has multiple text boxes, i need it to save the text that is put in the textbox automatically when the program is closed.. I couldnt find a solution anywhere! Hopefully i can find some help <3 Which are the names of these text boxes?: Hint: Select Text box control on your design view form, press F4 and see the content of Name property.
Jan 16, 2017 04:15 PM
(This post was last modified: Jan 16, 2017 04:17 PM by iNCEPTiON_V.)
You can use JSON, XML , or a normal text file to save data, but since your using visual studio you can use ApplicationSettingsBase.
something like this Code Properties.Settings.Default["SomeProperty"] = textBox.Text;Use the Closing Event of your Form to save before the application Exits. but i personally would save my data(models) with JSON since its literally 2 lines to Serialize and Deserialize my Data. |
|
|


