ejecutar un reporte de Crystal Report en vb

9 views
Skip to first unread message

Luis Vzla

unread,
Feb 7, 2024, 3:23:13 PM2/7/24
to C#.NET Latinoamérica
tengo un reporte que hice en cystal report y lo invoco en vb de la siguiente forma
cr.conectar(Servidor, BD, UsuarioDB, claveusuario)
                cr.printrpt("rpt_estadoCuentaResumen_porCuenta - sin descuento
Public Shared Sub conectar(ByVal servidor As String, ByVal basedatos As String, ByVal usuario As String, ByVal password As String)
        loginfo = New CrystalDecisions.Shared.ConnectionInfo
        loginfo.ServerName = servidor
        loginfo.DatabaseName = basedatos
        loginfo.UserID = usuario
        loginfo.Password = password
    End Sub
MesessinIntereses.rpt", "@idCuenta;" + dgvCuentas.Rows(ind).Cells(0).Value.ToString)
 Public Overloads Shared Sub printrpt(ByVal nombrereporte As String, ByVal ParamArray par() As String)
        Try
            Dim forma As New frmPrint
            Dim rpt As New ReportDocument
            With forma.CrystalReportViewer1
                If par.Length > 0 Then
                    .ParameterFieldInfo = genpar(par)
                End If
                rutaRpt = rutaRep
                If rutaRpt = Nothing Then
                    rpt.Load(nombrereporte, OpenReportMethod.OpenReportByDefault)
                ElseIf Mid(rutaRpt.Trim, rutaRpt.Trim.Length, 1) = "\" Then
                    rpt.Load(rutaRpt & nombrereporte, OpenReportMethod.OpenReportByDefault)
                Else
                    rpt.Load(rutaRpt & "\" & nombrereporte, OpenReportMethod.OpenReportByDefault)
                End If

                logonrpt(rpt)

                'Configurar aquí cualquier opción de exportación

                Dim opt As New ExportOptions
                opt = rpt.ExportOptions

                'Configurar aquí cualquier opción de impresión

                Dim prn As PrintOptions
                prn = rpt.PrintOptions
                .ReportSource = rpt

                'Visualizar el reporte en una ventana nueva

                forma.Text = custTitle
                forma.Show()
                forma.WindowState = 2
            End With
        Catch ex As Exception
            MessageBox.Show(ex.Message + " " + ex.GetType.ToString, "Error.", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try

    End Sub
dentro del mismo reporte tengo un subinforme y cuando se ejecuta me pide el parametro que mando del subinforme, como le puedo hacer para que eso no siga pasando
Reply all
Reply to author
Forward
0 new messages