Question Windows Report Viewer

Waterman292

New member
Joined
Nov 24, 2012
Messages
1
Programming Experience
Beginner
Hello

I am busy with a project using VB 2010. I keep getting this error message " Overload Resolution failed because no accessible 'New' is most specific for the arguements.

Here is the some of the code :

' show the correct report

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
' remove previous report
Me.Controls.Remove(RV)
RV.Dispose()
RV = New Microsoft.Reporting.WinForms.ReportViewer
RV.Parent = GroupBox2
RV.Dock = DockStyle.Fill
RV.Visible = True

' check the first report

If ComboBox1.Text = "Total profit for all time" Then
' fill the information for that report
Dim TA As New POSDSTableAdapters.TotalProfitForAllTimeTableAdapter
Dim TmpDS As New POSDS
TA.Fill(TmpDS.TotalProfitForAllTime)
' clear previous DS
RV.LocalReport.DataSources.Clear()

' create new DS

Dim RDS As New Microsoft.Reporting.WinForms.ReportDataSource("POSDS_TotalProfitForAllTime", TmpDS.TotalProfitForAllTime)
' tell the report control to use the DS, and
' use the report template created by us.
RV.LocalReport.DataSources.Add(RDS)
RV.LocalReport.ReportEmbeddedResource = "POS.TotalProfitForAllTime.rdlc"
RV.RefreshReport()


The problem is with this line of code "Dim RDS As New Microsoft.Reporting.WinForms.ReportDataSource("POSDS_TotalProfitForAllTime", TmpDS.TotalProfitForAllTime)"

In vb 2008 it works fine. Has anyone have any idea for the fix

Thanks
 
You are trying to invoke a ReportDataSource constructor with the wrong type of arguments. Have a look at the documentation for that class and see what overloads there are for the constructor and what the data types are for the parameters, then make sure that your code provides arguments with the correct data types. For instance, if the constructor has a parameter of type Integer then don't pass it a String.

You really ought to turn Option Strict On in this and all other projects also.
 
Back
Top