public void TaoMaDinhDanh() { string gt = GioiTinh(); string year = dt_NgaySinh.Value.Year.ToString(); txtMaDinhDanh1.Text = TrinhTaoMa.TangMa12Kytu(gt, year); }
private void tbmadinhdanh_Enter(object sender, EventArgs e) { string gioiTinh = rdNam.Checked ? "nam" : "nu"; try { tbmadinhdanh.Text = string.IsNullOrEmpty(tbmadinhdanh.Text) ?TrinhTaoMa.TangMa12Kytu(gioiTinh, dtpNgaySinh.Value.Year.ToString()): tbmadinhdanh.Text; tbmadinhdanh.SelectAll(); //tbmadinhdanh.SelectionStart = 0; //tbmadinhdanh.SelectionLength = tbmadinhdanh.Text.Length; } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }