private void cmbSearch_SelectedIndexChanged(object sender, EventArgs e) { MarikinaOpticalEntities dbContext = new MarikinaOpticalEntities(); switch (cmbSearch.SelectedIndex) { case 0: dgvListOfPatient.DataSource = dbContext.GetPatientsId(); txtSearch.Enabled = false; break; case 1: dgvListOfPatient.DataSource = dbContext.SearchSerialNoRx(txtSearch.Text); txtSearch.Enabled = true; break; case 2: dgvListOfPatient.DataSource = dbContext.SearchNameRx(txtSearch.Text); txtSearch.Enabled = true; break; default: break; } }