Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

How do i save the text in a textbox?

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
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.
(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)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
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)
Properties.Settings.Default.Save();

text1 is what I simply assume you're calling your premade property, though it might have a different name.
Now im getting this error
CS0103 The name 'textbox1' does not exist in the current context
(Jan 16, 2017 03:42 PM)Mqson Wrote:  Now im getting this error
CS0103 The name 'textbox1' does not exist in the current context

What did you name the textbox?
Did you add a textbox?
(Jan 16, 2017 03:42 PM)Gt403cyl Wrote:  What did you name the textbox?
Did you add a 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.

What is the name property of 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.
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;
Properties.Settings.Default.Save();

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.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by FarosMolokoFeb 24, 2019 07:05 AM 8 317 Feb 24, 2019 07:05 AM
Last Post: gigajew
[C#] by MeterpreterFeb 4, 2019 10:26 PM 5 177 Feb 4, 2019 10:26 PM
Last Post: Meterpreter
[C#] by MarwixAug 4, 2017 02:56 AM 8 418 Aug 4, 2017 02:56 AM
Last Post: Marwix