Jump to content

[vb.net 2005 ] crystal reports com variaveis....


rui_fernandes

Recommended Posts

Boas.

Neste exemplo estou a usar TextBox no report não há Labels!!

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Dim crDatabase As Database
Dim crTables As Tables
Dim crTable As Table
Dim crTableLogOnInfo As TableLogOnInfo
Dim crConnectionInfo As ConnectionInfo


Dim crReportDocument As New CrystalReport1
crConnectionInfo = New ConnectionInfo
With crConnectionInfo
    .ServerName = "Ares"
    .DatabaseName = "Dinefer"
    .UserID = "Utilizador"
    .Password = "ab,cdef123!"
End With
crDatabase = crReportDocument.Database
crTables = crDatabase.Tables
For Each crTable In crTables
    crTableLogOnInfo = crTable.LogOnInfo
    crTableLogOnInfo.ConnectionInfo = crConnectionInfo
    crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next
'' altera desc
If tipo_de_documento.Trim.ToLower = "linha" Then

    Dim crreportobject As CrystalDecisions.CrystalReports.Engine.ReportObject
    For Each crreportobject In crReportDocument.ReportDefinition.ReportObjects
        If TypeOf (crreportobject) Is CrystalDecisions.CrystalReports.Engine.TextObject Then
            Dim crtextobject As CrystalDecisions.CrystalReports.Engine.TextObject = DirectCast(crreportobject, CrystalDecisions.CrystalReports.Engine.TextObject)
            If crreportobject.Name.TrimEnd = "Text3" Then
                crtextobject.Text = "Custo de uma linha da Obra discriminado por Familias"
            End If
            If crreportobject.Name.TrimEnd = "Text5" Then
                crtextobject.Text = " - Pos " & PosObra_ & " - "
            End If
        End If
    Next

End If

formula=string.empty
crReportDocument.RecordSelectionFormula = formula
CrystalReportViewer1.DisplayGroupTree = False
CrystalReportViewer1.Zoom(100)
CrystalReportViewer1.ReportSource = crReportDocument

"The Dark Side Clouds Everthing. Impossible To See The Future Is."My rig: Intel Core 2 Quad Q9450 | abit IP35P | 4G Kingston 800 Mhz | XFX GeForce 9800 GX2 1G ddr3 | 2X WD5000AAJS 500Gb Sata 2 | PSU 600W || Caixa El-Diablo | Creative XMod

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.