Hola muy buenas a todos:
He estado utilizando crystal Reports XI con Vb6 sin ningun tipo de problema(con objetos CRAXDRT.Applicationy CRAXDRT.report).
Para mandarle las formulas al report en Vb6 utilizo:
Public Sub SetCrFormula(ByVal sNomFormula As String, ByVal sFormula As String)
Dim crFormulaFields As CRAXDRT.FormulaFieldDefinitions
Dim crFormulaField As CRAXDRT.FormulaFieldDefinition
Set crFormulaFields = crReport.FormulaFields
For Each crFormulaField In crFormulaFields
DoEvents
If LCase$(crFormulaField.FormulaFieldName) = LCase$(sNomFormula) Then
crFormulaField.Text = sFormula
Set crFormulaField = Nothing
Exit For
End If
DoEvents
Next
Set crFormulaFields = Nothing
End SubPero en vb.net no encuentro el FormulaFieldsDefinition. Todo lo que logrado convertir ha sido esto..
crReport = New ReportDocument
crReport.Load(NomReport)
Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
myConnectionInfo.ServerName = mvarServidor
myConnectionInfo.DatabaseName = mvarNomBaseDades
myConnectionInfo.UserID = mvarUsuari
If mvarContrasenya Is Nothing Then
myConnectionInfo.Password = ""
Else
myConnectionInfo.Password = mvarContrasenya
End If
SetDBLogonForReport(myConnectionInfo, crReport)
Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo, ByVal myReportDocument As ReportDocument)
Dim myTables As Tables = myReportDocument.Database.Tables
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
For Each myTable In myTables
Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo
myTableLogonInfo.ConnectionInfo = myConnectionInfo
myTable.ApplyLogOnInfo(myTableLogonInfo)
Next
End Sub
Y para lanzarlo lo meto en un formulario con un Viewer:
frmCrystal.Show()
frmCrystal.CrystalReportViewer1.ReportSource = crReport
frmCrystal.CrystalReportViewer1.Show()
Como puedo pasarle formulas en vb.net??? Muchas gracias