private void AcceptButton_Click(object sender, EventArgs e) { if (textBoxPName.Text.Trim() == "") { MessageBox.Show("Please enter a valid name."); } else { PatientProfile patient = new PatientProfile(); patient.name = textBoxPName.Text; SaveFileDialog sfd = new SaveFileDialog(); sfd.FileName = patient.name + ".txt"; sfd.DefaultExt = ".txt"; sfd.AddExtension = true; sfd.ShowDialog(); patient.filePath = sfd.FileName; // make new client file StreamWriter sw = new StreamWriter(patient.filePath); sw.WriteLine(patient.name); ControlForm.currentPatient = patient; sw.Close(); Close(); } }
private void loadPatientToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { currentPatient = new PatientProfile(ofd.FileName); getPatientInfo(); } }