1

I have to write a program for school.

In this program I have a couple of textboxes, the data from the textboxes has to be saved but not in a file. The form looks like this:

enter image description here

When the Save button is pressed, it has to save the data that is entered in the textboxes.

My second question is: I have the "<" and ">" buttons with these I have to make that they can change between the saved data. I would make it with a list but my knowledge is too little for it.

Thanks for every answer I get.

(Sorry for my bad English, I am learning the language)

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Jeng
  • 13
  • 5

1 Answers1

0

First, Data must be saved somewhere physically, like a file or DB. Class is just a structural concept NO data is stored there. So Define a class say Person and with every save button clicked collect data from your form to Person object pass it to your (data storage) like a file.

  • Can you make an example ? and thanks for the explanation. – Jeng Jun 05 '16 at 13:33
  • `Class Person{ public string Name{get;set;} public int Age{get;set;} public string Address{get;set;} }` When ButtonSave clicked `Person p1 = new Person{ Name = textBox1.Text; Age = Convert.ToInt32(textBox2.Text); Address = textBox3.Text; }` Then Write your object to your file see these links: http://stackoverflow.com/questions/7569904/easiest-way-to-read-from-and-write-to-files https://msdn.microsoft.com/en-us/library/6ka1wd3w(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/8bh11f1k.aspx – Abdelmneim Hussein Jun 05 '16 at 14:45
  • Thank you sooo much, you helped me alot. – Jeng Jun 05 '16 at 15:29