private void SetAutoCompletionForDiagnosisNames() { var namesCollection = new AutoCompleteStringCollection(); namesCollection.AddRange(DiagnosisManager.GetAllDiagnosis().Select(d => d.Name).ToArray()); SetAutoCompleteSourceForTextBox(txtDiagnosis, namesCollection); }
private void btnAddDiagnosis_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; if (string.IsNullOrEmpty(txtDiagnosis.Text.FullTrim())) { txtDiagnosis.BackColor = ErrorColor; Cursor = Cursors.Default; return; } if (!DiagnosisManager.IsDiagnisiFound(txtDiagnosis.Text.FullTrim())) { DiagnosisManager.AddDiagnosi(new Diagnosi { Name = txtDiagnosis.Text.FullTrim() }); } Diagnosis.Add(new DiagnosiVm { DiagnosiName = txtDiagnosis.Text.FullTrim() }); ClearDiagnosisInputs(); FillDiagnosisGrid(); SetAutoCompletionForDiagnosisNames(); Cursor = Cursors.Default; }