public void addPerson() { //add person to list of people string text = firstName.Text + "," + emailAdress.Text + "," + phoneNumber.Text; string[] info = text.Split(','); Person personInfo = new Person(); personInfo.Name = info[0]; personInfo.Email = info[1]; personInfo.Phone = info[2]; people.Add(personInfo); }
public void refreshInfo() { //update update information from file to be able to display informaiton about people StreamReader Reader = new StreamReader(strFilePath); string s = Reader.ReadLine(); while (s != null) { string[] info = s.Split(','); Person personInfo = new Person(); personInfo.Name = info[0]; personInfo.Email = info[1]; personInfo.Phone = info[2]; people.Add(personInfo); s = Reader.ReadLine(); } Reader.Close(); }
public void readFromFile() { infoBox.Items.Clear(); StreamReader Reader = new StreamReader(strFilePath); string s = Reader.ReadLine(); while (s != null) { string[] info = s.Split(','); Person personInfo = new Person(); personInfo.Name = info[0]; personInfo.Email = info[1]; personInfo.Phone = info[2]; people.Add(personInfo); infoBox.Items.Add(personInfo.Name); s = Reader.ReadLine(); } Reader.Close(); }