public bool CheckUniqueID(string StudentId, out bool correct) { StreamReader reader = new StreamReader(path1); string s_record = reader.ReadToEnd(); reader.Close(); correct = false; createProfile obj = new createProfile(); if (StudentId[2] == '-' && StudentId[9] == '-' && StudentId.Length.Equals(13)) { correct = true; } else { correct = false; MessageBox.Show("Invalid ID, try again: "); obj.textID.Text = ""; } if (s_record.Contains(StudentId)) { MessageBox.Show("This Student ID has already been saved, try again: "); obj.textID.Text = ""; } return(correct); }
private void button1_Click(object sender, EventArgs e) { createProfile cp = new createProfile(); cp.Show(); this.Hide(); }