private void cmbNgay_SelectedIndexChanged(object sender, EventArgs e) { try { DataRow r; if (ds.Tables[0].Rows.Count > 0) { r = m.getrowbyid(ds.Tables[0], "id=" + cmbNgay.SelectedValue); if (r == null) { r = m.getrowbyid(ds.Tables[0], "id=" + ds.Tables[0].Rows[0]["id"].ToString()); d_id = decimal.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } d_id = decimal.Parse(r["id"].ToString()); txtNgay.Value = m.StringToDateTime(r["ngay"].ToString()); txtSieuam.Text = r["sieuam"].ToString(); txtKeocs.Text = r["keodan"].ToString(); txtDien.Text = r["dien"].ToString(); txtTutruong.Text = r["tutruong"].ToString(); txtApsuat.Text = r["apsuat"].ToString(); txtKhac.Text = r["khac"].ToString(); txtMabs.Text = r["mabs"].ToString(); txtMabs_Validated(null, null); } else { emp_detail(); } } catch { } }