private void ByByWindows(object sender, FormClosedEventArgs e) { Form frm; if (sender is Form) { frm = (Form)sender; if (frm == frmLietKeTinhGia) { frmLietKeTinhGia = null; } if (frm == frmBangGiaGiay) { frmBangGiaGiay = null; } if (frm == frmBangGiaThanhPham) { frmBangGiaThanhPham = null; } if (frm == frmBangGiaInNhanh) { frmBangGiaInNhanh = null; } if (frm == frmBangGiaInNhanhMay) { frmBangGiaInNhanhMay = null; } if (frm == frmTinhThu) { frmTinhThu = null; } } }
private void btnBangGiaThanhPham_Click(object sender, EventArgs e) { if (frmBangGiaThanhPham == null) { frmBangGiaThanhPham = new BangGiaThanhPhamForm(); frmBangGiaThanhPham.MinimizeBox = false; frmBangGiaThanhPham.MaximizeBox = false; frmBangGiaThanhPham.FormClosed += new FormClosedEventHandler(ByByWindows); frmBangGiaThanhPham.Show(); } else { frmBangGiaThanhPham.Focus(); } }