private void setFormFields(int index) { try { txtID.Text = dgvList.Rows[index].Cells["colID"].Value.ToString(); DataTable dt = med.getRecordFromID(Convert.ToInt32(txtID.Text)); txtName.Text = dt.Rows[0]["name"].ToString(); txtDesc.Text = dt.Rows[0]["prescription"].ToString(); PopulateProcTypeCombo(Convert.ToInt32(dt.Rows[0]["type"].ToString())); cmbProcType.SelectedValue = dt.Rows[0]["type"].ToString(); //cmbProcType.SelectedItem = cmbProcType.FindStringExact(cmbText); chkActive.Checked = Convert.ToBoolean(dt.Rows[0]["active"].ToString()); } catch (Exception ex) { CommonLogger.Info(ex.ToString()); } }