Search code examples
vb.netexceptiondllreport

Exception by using basic functionality (e.g. overallpagenumber) in VB.net Report


I will create reports (Link) in my VB.net-Application (VS2015). For that I bind some own objects/classes as datasource to the local-report. I also insert these classes as datasource in the RDLC-Report. Then I use the data of these classes in the report, e.g. in a table or textbox. When I start my application and create the report. All works fine. The data from my instance of the class are placed in the report. Great! (PS: The used class are inside in a separate DLL, written by my own.)

Then I will make my report a little bit nicer. I add a header and place a textbox with the current page number there. (Drag'n'Drop from Report-Data-View) After that I want to restart my app, but I get an error. I delete the textbox >> no error. I insert the textbox with the "overpagenumber" again >> error!

But the error said: That he can not find my DLL(=S88Model). (errormessage is translated)

Error loading the code module: 'S88Model, version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Details: The file or assembly "S88Model, Version=1.0.0.0.0, Culture=neutral, PublicKeyToken=null" or a dependency on it was not found. The system cannot find the specified file.

I checked my DLL. All right, the link is my app. Also the file in the "Bin/Debug/" directory.

How can help me?

PS: I create a new app with a report and only the "pagenumber" and it works.

PS: Here is a part of my code:

Public Function ShowReport(ByRef pViewer As ReportViewer, pObj As Object) As Boolean

pViewer.ProcessingMode = ProcessingMode.Local
Dim locReport As LocalReport = pViewer.LocalReport
Dim parameterListe As New List(Of ReportParameter)


Select Case pObj.GetType
    Case GetType(S88Model.Items.CEmType)

        Dim emType As S88Model.Items.CEmType = pObj
        locReport.ReportEmbeddedResource = "TechEditor.ReportEmType.rdlc"
        Dim bs As New Windows.Forms.BindingSource()
        bs.DataSource = emType

        Dim reportdatasource As New ReportDataSource()
        reportdatasource.Name = "EmTypeDataSet"
        reportdatasource.Value = bs

        Dim bs2 As New Windows.Forms.BindingSource()
        bs2.DataSource = CProjectData.DefaultData
        Dim reportdatasource2 As New ReportDataSource()
        reportdatasource2.Name = "ProjectDataSet"
        reportdatasource2.Value = bs2


        locReport.DataSources.Add(reportdatasource)
        locReport.DataSources.Add(reportdatasource2)
        pViewer.RefreshReport()

        ...

Solution

  • I tried to create an other report. The new report is working (external DLL + Standard-Variablen).

    After that I checked my first report, where I get errors at compiling. I looked into the XML of the report. At the end of the xml-file there are some lines like "codemodel", where my DLL was linked. After I deleted the complete "CodeModel"-Tag in the XML I get no error. And it works. Now I have only DLL-Link-Information in the "DataSetInfo"-Tag of the xml-file.

    I do not why, but it runs now. Thanks @Craig for support.