private void Form1_Load(object sender, EventArgs e) { toolStripComboBox1.SelectedItem = "广东省其他非税收入通用票据"; tabPage1.Text = "广东省其他非税收入通用票据"; Income income = new Income(); tabPage1.Controls.Add(income); this.reportViewer.LocalReport.LoadReportDefinition(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("ZBPMPRINT.Income.rdlc")); this.reportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("ZBPMPRINT_clsIncome", new clsIncome[] { ((Income)tabPage1.Controls.Find("income", true)[0]).ClsObject })); this.reportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("ZBPMPRINT_clsItem", ((Income)tabPage1.Controls.Find("income", true)[0]).ClsObject.Items)); this.reportViewer.RefreshReport(); }
private void toolStripComboBox1_SelectedIndexChanged(object sender, EventArgs e) { try { for (int i =tabPage1.Controls.Count ; i > 0;i--) { tabPage1.Controls.RemoveAt(i-1); } this.reportViewer.Reset(); //this.reportViewer.LocalReport.DataSources.Clear(); if ((sender as ToolStripComboBox).SelectedItem.ToString() == "电汇凭证") { tabPage1.Text = "电汇凭证"; TelegraphicMoneyOrdertelegraph telegraphicMoneyOrdertelegraph = new TelegraphicMoneyOrdertelegraph(); tabPage1.Controls.Add(telegraphicMoneyOrdertelegraph); } else if ((sender as ToolStripComboBox).SelectedItem.ToString() == "中山市财政局专用缴款书") { tabPage1.Text = "中山市财政局专用缴款书"; Financial financial = new Financial(); tabPage1.Controls.Add(financial); } else if ((sender as ToolStripComboBox).SelectedItem.ToString() == "中国建设银行支票") { tabPage1.Text = "中国建设银行支票"; Check check = new Check(); tabPage1.Controls.Add(check); } else if ((sender as ToolStripComboBox).SelectedItem.ToString() == "广东省行政事业单位往来结算票据") { tabPage1.Text = "广东省行政事业单位往来结算票据"; Balance balance = new Balance(); tabPage1.Controls.Add(balance); } else if ((sender as ToolStripComboBox).SelectedItem.ToString() == "广东省其他非税收入通用票据") { tabPage1.Text = "广东省其他非税收入通用票据"; Income income = new Income(); tabPage1.Controls.Add(income); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }