Jump to content

Reading / Writing Objects

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
ahmed

ahmed

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 304 posts
I am planning to make an address book in C# win forms , so I wanted to know that how can I read and write objects ?cause i will be making a separate class file for the data (name,address,phoneNo) so can anyone help me out?

#2
cdg10620

cdg10620

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 389 posts
If I were you what I could do is create a class called Information or Contact and then have another class that is a collection of these contacts. The Contact class can have properties like first name, middle name, last name, phone numbers, e-mail, etc. When the user inputs this information it is then saved in the form and the contact is saved into the "AddressBook" or "ContactCollection." You need to allow the user to save these contacts so you may want to make the class serializeable and save an XML document that has all of the contact information. This is the way I would implement it.

As for reading information, just get the values from the form when the user inputs them and clicks a save button. If you need any more help let me know.
-CDG10620
Software Developer