public ExportDataForm(ReadOnlyCollection <BaseExportComponentFrom> list, params DataTable[] tables) { InitializeComponent(); ExportWithColumnName = true; title = this.Text; this.tables = tables; if (tables == null) { throw new ArgumentNullException("'tables' is null"); } if (tables.Length == 0) { throw new ArgumentNullException("'tables' is empty"); } if (list == null) { throw new ArgumentNullException("'list' is null"); } if (list.Count < 1) { throw new ArgumentNullException("'list' is empty"); } curForm = null; lstExport = list; if (lstExport.Count < 1) { throw new ArgumentNullException("All child form of list can not run!"); } foreach (var t in tables) { cbxExportData.Items.Add(t.TableName); } cbxExportData.SelectedIndex = 0; if (tables.Length == 1) {//Only one for export : Not show this combobox int dy = pnlExport.Location.Y - cbxExportData.Location.Y; cbxExportData.Visible = false; pnlExport.Location = new Point(pnlExport.Location.X, pnlExport.Location.Y - dy); pnlExport.Size = new Size(pnlExport.Size.Width, pnlExport.Size.Height + dy); } }
private void LbxExport_SelectedIndexChanged(object sender, EventArgs e) { if (curForm != null) { curForm.Visible = false; } int i = lbxExport.SelectedIndex; if (i != -1) { curForm = lstExport[i]; curForm.Visible = true; btnExport.Enabled = curForm.ValidData(); } else { curForm = null; btnExport.Enabled = false; } }
void BaseExportComponentFrom_ValidDataChanged(object sender, EventArgs e) { BaseExportComponentFrom config = (BaseExportComponentFrom)sender; btnExport.Enabled = config.ValidData(); }