views:

18

answers:

1

I'm writing a report in VB .NET (using Active Reports) that displays details about a location, and then displays a bunch of images, which are stored in a database. The images are displayed in my main report via a subreport.

However, I can't get the images to load. I have two files, the main report (rptMain) and the image subreport (rptSubImages). The sub Detail1_Format in the rptSubImages never gets ran, which is why the images are not appearing, and I can't figure out why! I've included the code below... can anyone pinpoint why my subreport detail section isn't getting called? The rptSubImages report gets initialized, but if I put a stop point inside the detail sub, it never gets caught during debug.

Here is the code:

rptMain:


Imports DataDynamics.ActiveReports 
Imports DataDynamics.ActiveReports.Document 
Imports System.Data
Imports System.Data.OleDb

Public Class rptMain
    Private rpt As rptSubImages

    Private Sub rptMain_ReportStart(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ReportStart

    End Sub

    Private Sub Detail1_Format(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Detail1.Format
        Me.SubReport2.Report = rpt

        Dim cmd As New OleDbCommand("rptMain")
        cmd.Parameters.Add("@LocationID", OleDbType.Integer).Value = locationID

        Windows.Forms.Cursor.Current = Cursors.WaitCursor

        Dim dsLocationInfo As DataSet = objPlugIn.GetProcDataset(cmd, Aquifer.PlugIn.DataFormat.Compressed)


        '--image
        Dim dtImage As DataTable = dsLocationInfo.Tables(1)
        If dtImage.Rows.Count > 0 Then
            rpt = New rptSubImages
            SubReport2.Report = rpt
            SubReport2.Report.DataSource = dtImage
        End If
    End Sub
End Class

rptSubImages:


Imports DataDynamics.ActiveReports 
Imports DataDynamics.ActiveReports.Document 

Public Class rptSubImages 
    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub Detail1_Format(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Detail1.Format
        'some text
    End Sub
End Class 
A: 

Solved my own problem :) I bumped the section that created and set values of the subreport out of Detail_Format and put it in ReportStart of rptMain, and voila, it loads :) I just had it in the wrong part of the main form!

Carrie Nelson