private void search_Click(object sender, EventArgs e) { try { XmlNode patients = ThisAddIn.GetPatientsList(gjtEmrPatients.QueryMode.PatientName, txtName.Text.ToString().Trim()); if (patients != null) { if (patients.ChildNodes.Count > 0) { //string filename = Path.Combine(Globals.currentDirectory, "patients.xml"); //if (File.Exists(filename)) File.Delete(filename); //XmlWriter writer = XmlWriter.Create(filename); //patients.WriteTo(writer); //writer.Close(); ThisAddIn.LoadTreeviewWithPatients(tvSelect, patients); } else { MessageBox.Show(EmrConstant.ErrorMessage.NoFindResult, EmrConstant.ErrorMessage.Warning); } } } catch (Exception ex) { Globals.logAdapter.Record("EX925511256769", ex.Message + ">>" + ex.ToString(), true); } }