void txtMa_Hd_Validating(object sender, CancelEventArgs e) { string strValue = txtMa_Hd.Text.Trim(); bool bRequire = false; frmHopDong frmLookup = new frmHopDong(); DataRow drLookup = Lookup.ShowLookup(frmLookup, "LIHOPDONG", "Ma_Hd", strValue, bRequire, ""); if (bRequire && drLookup == null) { e.Cancel = true; } if (drLookup == null) { txtMa_Hd.Text = string.Empty; lbtTen_Hd.Text = string.Empty; } else { txtMa_Hd.Text = drLookup["Ma_Hd"].ToString(); lbtTen_Hd.Text = drLookup["Ten_Hd"].ToString(); } dicName.SetValue(lbtTen_Hd.Name, lbtTen_Hd.Text); if ((((txtTextLookup)sender).AutoFilter != null) && ((txtTextLookup)sender).AutoFilter.Visible) { ((txtTextLookup)sender).AutoFilter.Visible = false; this.SelectNextControl(this.ActiveControl, true, true, true, true); } }
private void mnlaphopdong_Click(object sender, EventArgs e) { foreach (Form mdiChild in this.MdiChildren) { if (mdiChild.Name == "frmHopDong") { mdiChild.Activate(); return; } } frmHopDong uc = new frmHopDong(); uc.Show(); uc.MdiParent = this; }