on 04-10-2010 9:51 PM
Hello,
In VB6 I have unbound fields and method SetUnboundFieldDataSource to bound those fields at runtime, but in VS 2005 there is no way to handle unbound fields?
I have desktop application, some CR report with unbound fields 1,2,3.
At runtime I want to set CR,datasource to DataTable and to bound unbound fields 1,2,3 to DataTable fields 1,2,3. How to do this?
Thanks in advance
Create three formulas; formula1,formula2, formula3. Populate those formulas with your data. One formula example;
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form1
Inherits System.Windows.Forms.Form
Dim Report As New CrystalReport1()
Dim FormulaFields As FormulaFieldDefinitions
Dim FormulaField As FormulaFieldDefinition
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
FormulaFields = Report.DataDefinition.FormulaFields
FormulaField = FormulaFields.Item(0)
FormulaField.Text = "[formula text]"
CrystalReportViewer1.ReportSource = Report
End Sub
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Ludek,
I understand this part with formulas.
FormulaField = FormulaFields.Item(0)
FormulaField.Text = "[formula text]"
But how to do this:
I have DataTable with 3 columns: ID, Name, Email
I want at runtime to bound like this:
FormulaFields.Item(0). datasource = dt.columns["ID"]
FormulaFields.Item(1). datasource = dt.columns["Name"]
FormulaFields.Item(2). datasource = dt.columns["Email"]
How to do this, in VB6 there is method like this:
Report.Database.SetDataSource Rs
Report.AutoSetUnboundFieldSource crBMTName
or like this:
Dim fld As FieldObject
Set fld = Report.Sections("D").ReportObjects(1)
fld.SetUnboundFieldSource "{Customer.Customer ID}"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.