Wednesday, August 20, 2008

"With Events" Error When Business Reports Are Enabled

Visual Basic developers were experiencing a code compilation error when generating a Web Form Builder project with business object reports. Three reporting link buttons on the business object gird user controls allow to print the content of the grid with the currently applied data filters in Adobe PDF, Microsoft Excel, and TIFF image format. These buttons were incorrectly referring to the shared event handler.

The problem has been fixed. The generated code now reads as the following:

Protected Sub RenderReportCommand(ByVal e As CommandEventArgs)
        ApplyDataFilter()
        Dim showLines As String = "True"
        If (CType(e.CommandArgument, String) = "Excel") Then
            showLines = "False"
        End If
        ReportUtility.CreateReport(CType(e.CommandArgument, String), "~/Reports/Customers.rdlc", _
            New ReportParameter() {New ReportParameter("ShowLines", showLines)}, _
            SqlDataSource1, GridView1)
    End Sub

    Protected Sub RenderReport1_Command(ByVal sender As Object, _
                                        ByVal e As CommandEventArgs) Handles RenderReport1.Command
        RenderReportCommand(e)
    End Sub

    Protected Sub RenderReport2_Command(ByVal sender As Object, _
                                        ByVal e As CommandEventArgs) Handles RenderReport2.Command
        RenderReportCommand(e)
    End Sub

    Protected Sub RenderReport3_Command(ByVal sender As Object, _
                                        ByVal e As CommandEventArgs) Handles RenderReport3.Command
        RenderReportCommand(e)
    End Sub

This problem has not been affecting Visual C# developers.

If you were experiencing this problem then start CodeOnTime.exe and you will be automatically prompted to download the update. Generate the project with reports and enjoy.

No comments:

You can find more about Code OnTime Generator, Data Aquarium Framework, and other great products here.


© 2010 Code OnTime LLC. Intelligent code generation software for ASP.NET. Visit us at http://codeontime.com