Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27329

VS 2010 I can print the crystal report but Icant view Crystal Report in Crystal Report Viewer

$
0
0
I instructed my program to show up the crystal report in the CR Viewer and print menu after. but only blank form shows up and the print menu. I can print the report but i cant see it in the report viewer. Help me guys

here is my code in my program:

If MessageBox.Show("Do you want to print receipt?", "Print", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.Yes Then
FillLv("Select InvoiceNo,QuantitySold,UnitPrice,CustomerName,CustomerAddress,ProductName,Subtotal,Change,Cash,Tax,V atable,TotalAmt,Cashier from SalesTransactionDetails Where InvoiceNo = '" & lblInvoice.Text & "'", lvPOS2)
ReportSales(lvPOS2)
frmReports.Show()
ReportViewer.CrystalReportViewer1.PrintReport()
End If


here is my code in ReportModule:

Public Sub ReportSales(ByVal LV As ListView)
Dim rReport As New rptSales
Dim row As DataRow = Nothing
Dim ds As New DataSet
ds.Tables.Add("SalesTransactionDetails")
With ds.Tables(0).Columns
.Add("InvoiceNo")
.Add("QuantitySold")
.Add("UnitPrice")
.Add("CustomerName")
.Add("CustomerAddress")
.Add("ProductName")
.Add("Subtotal")
.Add("Change")
.Add("Cash")
.Add("Tax")
.Add("Vatable")
.Add("TotalAmt")
.Add("Cashier")
End With
For Each LVI As ListViewItem In LV.Items
row = ds.Tables(0).NewRow
row(0) = LVI.Text
row(1) = LVI.SubItems(1).Text
row(2) = Format(Val(LVI.SubItems(2).Text), "#,##0.00")
row(3) = LVI.SubItems(3).Text
row(4) = LVI.SubItems(4).Text
row(5) = LVI.SubItems(5).Text
row(6) = Format(Val(LVI.SubItems(6).Text), "#,##0.00")
row(7) = Format(Val(LVI.SubItems(7).Text), "#,##0.00")
row(8) = Format(Val(LVI.SubItems(8).Text), "#,##0.00")
row(9) = Format(Val(LVI.SubItems(9).Text), "#,##0.00")
row(10) = Format(Val(LVI.SubItems(10).Text), "#,##0.00")
row(11) = Format(Val(LVI.SubItems(11).Text), "#,##0.00")
row(12) = LVI.SubItems(12).Text
ds.Tables(0).Rows.Add(row)
Next
rReport.SetDataSource(ds.Tables(0))
ReportViewer.CrystalReportViewer1.ReportSource = rReport
End Sub




The image in the attachment shows what happened if i try to view and print the crystal report

The frmRecord where the CystalReportViewer shows nothing.

Viewing all articles
Browse latest Browse all 27329

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>