private void buttonShowAllBarcode_Click(object sender, EventArgs e) { try { BarcodeReport barcodeReport = new BarcodeReport(); List<ReportProducts> products = AllProducts(); if (products.Count > 0) { barcodeReport.SetDataSource(products); BarcodeReportViewer.ReportSource = barcodeReport; } } catch (Exception exception) { MessageBox.Show(exception.Message); } }
private void buttonShowBarcode_Click(object sender, EventArgs e) { try { string bCode = textBox1.Text.Trim(); int no = Convert.ToInt32(textBox2.Text.Trim()); if (bCode == "") return; if (no < 0) return; BarcodeReport barcodeReport = new BarcodeReport(); List<ReportProducts> productses=new List<ReportProducts>(); ReportProducts aProducts = GetProduct(bCode); for (int i = 0; i < no; i++) { productses.Add(aProducts); } barcodeReport.SetDataSource(productses); BarcodeReportViewer.ReportSource = barcodeReport; } catch (Exception exception) { MessageBox.Show(exception.Message); } }