private void Form1_Load(object sender, EventArgs e) { ///folder needs to be located in desktop string path = @"\Desktop\AddressBookEmma\AddressBook\addresses.txt"; ///If file is in c:drive //string path = @"C\addresses.txt"; StreamReader reader = new StreamReader(path); int index = 0; try { for (string str = reader.ReadLine(); str != null; str = reader.ReadLine()) { string item = reader.ReadLine(); comboBox1.Items.Add(item); aContact[index] = new ContactS(str, item); aContact[index].Address = reader.ReadLine(); aContact[index].City = reader.ReadLine(); aContact[index].State = reader.ReadLine(); aContact[index].Zip = reader.ReadLine(); aContact[index].Phone = reader.ReadLine(); aContact[index].Email = reader.ReadLine(); index++; } } catch { } }
public void Remove(ContactS item) { context.Contacts.Remove(item); }
public ContactS Add(ContactS item) { return(context.Contacts.Add(item)); }