hi everyone,
i am creating a window application and its supposed to enter details then the details entered need to be saved.
i want to know how to save the information entered by a data clerk in the form
regards,
save button
Started by elizabethmwashuma, May 24 2010 05:51 AM
4 replies to this topic
#1
Posted 24 May 2010 - 05:51 AM
|
|
|
#2
Posted 24 May 2010 - 06:10 AM
There are so many options. You can connect to a database to save the data, create a plain text file, a custom binary file, you could choose whether to encrypt or not. There really are a lot of options. The easiest way is plain text.
However, loading the data may be more difficult that way if the file size becomes large. You should decide how you want to store your data before you worry about saving it.
// create a writer and open the file
TextWriter tw = new StreamWriter("filename.txt");
// write a line of text to the file
tw.WriteLine(TextBox1.Text);
// close the stream
tw.Close();
However, loading the data may be more difficult that way if the file size becomes large. You should decide how you want to store your data before you worry about saving it.
#3
Posted 24 May 2010 - 09:19 PM
thank you BuckAMayzing for your response.....so where exactly would i put the code.....on button click or on form_load?
#4
Posted 25 May 2010 - 12:42 AM
the code in form_load is executed when the form is loaded. If you want to save the data when you click the button, put it in the button_click event.
For more, check out the link to the tutorial in my signature
|
|
\ /
v
For more, check out the link to the tutorial in my signature
|
|
\ /
v
Are you a newbie programmer trying to learn C#? Check out my small tutorial: Visual C# Programming Basics
#5
Posted 26 May 2010 - 03:47 AM
I am sure you need more security for your data than just plane text ,check out how to serialize characters & protect from being read by common man
http://forum.codecal...-basic-net.html
http://forum.codecal...-basic-net.html


Sign In
Create Account


Back to top









