Share via


How to solve Overload Resolution failed because no accessible "New" is most specific for these arguments?

Question

Wednesday, May 8, 2013 4:31 AM

I got the error Overload Resolution failed because no accessible "New" is most specific for these arguments, the error is in declaring the RDS.
PrivateSub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
 
 
        If ComboBox1.Text = "Total Sales for all time"ThenDim TA AsNew POSDSTableAdapters.TotalSalesForAllTimeTableAdapterDim TmpDS As New POSDS
 
            TA.Fill(TmpDS.TotalSalesForAllTime)
            'clear previous DS
            RV.LocalReport.DataSources.Clear()
            'Create new DS            Dim RDS AsNew Microsoft.Reporting.WinForms.ReportDataSource("TotalSalesForAllTime", TmpDS.TotalSalesForAllTime)
 
            RV.LocalReport.DataSources.Add(RDS)
 
            RV.LocalReport.ReportEmbeddedResource = "BCOPOS.Report1.rdlc"
            RV.RefreshReport()
        EndIfEndSubEndClass  
             
              
 
              
     
 
 

All replies (10)

Wednesday, May 8, 2013 5:34 AM âś…Answered

The message is telling you that the Microsoft.Reporting.WinForms.ReportDataSource class does not have a constructor that takes that pair of arguments.  There might be one constructor, there might be several, but none of them expects to see a string and whatever type 'TmpDS.TotalSalesForAllTime' is.

You need to look at the definition for the Microsoft.Reporting.WinForms.ReportDataSource class and determine what constructor(s) it has, choose the one you are going to use, and include whatever argument(s) that constructor requires as an argument to your call to New.

http://msdn.microsoft.com/en-us/library/microsoft.reporting.winforms.reportdatasource.reportdatasource(v=vs.100).aspx


Wednesday, May 8, 2013 6:41 AM

Thanks sir Acamar, I was able to solve it using the link you gave me.


Monday, June 24, 2013 5:12 PM

How did you solve that?

I got a similar problem.


Monday, June 24, 2013 5:30 PM

How did you solve that?

I got a similar problem.

According to the post you replied to, the problem was solved by following the advice that Acamar gave in his reply.  When creating a new object, you need to supply the arguments required by one of the object's constructors.  If it is a ReportDataSource object you are creating, follow the link to the documentation in Acamar's reply.


Thursday, September 26, 2013 2:22 PM

Hi g_edwin14,

I got a similar problem. Could you share your code? 

I'm new for VB code but I need to learn from you guy.

thanks.

ilic


Thursday, September 26, 2013 2:48 PM

I got a similar problem. Could you share your code? 

I'm new for VB code but I need to learn from you guy.

Please provide some lines of your code. The solution is individual. His code perhaps won't help.

Armin


Thursday, September 26, 2013 3:04 PM

Hi Armin,

please see as below,

Dim TA AsNew POSDSTableAdapters.TotalSalesForAllTimeTableAdapter

Dim TmpDS As New POSDS

            TA.Fill(TmpDS.TotalSalesForAllTime)
            'clear previous DS
            RV.LocalReport.DataSources.Clear()
            'Create new DS

            Dim RDS AsNew Microsoft.Reporting.WinForms.ReportDataSource("TotalSalesForAllTime", TmpDS.TotalSalesForAllTime)

            RV.LocalReport.DataSources.Add(RDS)

            RV.LocalReport.ReportEmbeddedResource = "POS.TotalSalesForAllTime.rdlc"
            RV.RefreshReport()

Thanks,

ilic


Thursday, September 26, 2013 7:23 PM

Is this your code?  It looks like a copy of the OP code, even with the same mistakes.  Please show *your* code.


Friday, September 27, 2013 4:25 PM

No, it not my code. I copy the code as below to learn how to write the vb code and i has follow the link that can solve this issue but i don't understand how to solve it. So, can you show your code that solve this issue. Thanks.


Friday, September 27, 2013 9:30 PM

No, it not my code. I copy the code as below to learn how to write the vb code and i has follow the link that can solve this issue but i don't understand how to solve it.

If it is not your code then you cannot solve it because you do not know what you are trying to do by passing that invalid argument list to the constructor.   If you can describe what you expected that line of code to do, then perhaps someone can show you the correct form that it needs to be.  Your code must match one of the allowed constructors, but you have to choose your constructor according to the result that you want to see.