コード例 #1
0
        void tsbSearch_Click(object sender, EventArgs e)
        {
            frmSearch frmSearch = new frmSearch();
            Form      frm       = this.Parent.FindForm().GetType().Name == "frmMain" ? this.Parent.FindForm().ActiveMdiChild : this.Parent.FindForm();

            // Tim form tren tabcontrol
            if (frm == null)
            {
                frm = Common.FindFormChildInTab();
            }

            if (frm == null)
            {
                return;
            }

            object ExportControl = ((frmBase)frm).ExportControl;

            if (ExportControl == null)
            {
                return;
            }

            //dgvControl
            if (Common.Inlist(ExportControl.GetType().Name, "dgvControl,dgvReport,dgvVoucher"))
            {
                dgvControl dgv = (dgvControl)ExportControl;

                frmSearch.bdsSearch = (BindingSource)dgv.DataSource;
            }
            else if (Common.Inlist(ExportControl.GetType().Name, "tlControl,tlReport"))
            {
                tlControl tl = (tlControl)ExportControl;
                frmSearch.bdsSearch = (BindingSource)tl.DataSource;
            }
            frmSearch.Show();
        }