0

Can you help me? Im having this error when I click the button. It says A data source instance has not been supplied for the Data source 'BatchCodeGenerator'. And I have my Dataset.xsd also added, I dont know if it helps

Private Sub btnPreviewReport_Click(sender As Object, e As EventArgs) Handles btnPreviewReport.Click

Dim DataTable1 As DataTable = New DataTable("DataTable1")
DataTable1.Columns.Add("CardNo", System.Type.GetType("System.String"))
DataTable1.Rows.Add("22-001")
DataTable1.Rows.Add("22-002")
    
    
ReportViewer1.LocalReport.ReportPath = System.Environment.CurrentDirectory & "\Reports\BatchBarcodeGenerator.rdlc"
    
    
ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("BatchBarcodeGenerator", DataTable1))
    
Me.ReportViewer1.RefreshReport()

enter image description here

1 Answers1

0

If the error message is correct (BatchCodeGenerator) than you are using a wrong name for your ReportDataSource (BatchBarcodeGenerator).

ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("BatchCodeGenerator", DataTable1))
tezzo
  • 10,858
  • 1
  • 25
  • 48