Using Crystal Reports in VB.Net...
I have a report CrystalReport3.rpt
Basically I have a form ( form1) and based on the checkboxes selected and the date entered in the textbox ..a selection formula is built .
Then when a user clicks the Report button on form1 it is supposed to open a second form (form2 ) which contains the CrystalReportViewer and the report is supposed to be shown based on the selection formula.
Right now the report opens in form2 but it is not acknowledging the selection formula that was built on form 1.
I tried declaring the selection formula ( recSelect) on form1 as being shared
Public Class Form1
Inherits System.Windows.Forms.Form
Public Shared recSelect As String
'I thought doing it this way I would be able to see recSelect on form2
'later on in the code of form1 the selection formula is built as this
recSelect = "{table1.categories} = 'Colonial'"
Then on the Load of Form2 I have this code...
Dim report As New CrystalReport3
report.RecordSelectionForm
ula = Form1.recSelect
CrystalReportViewer1.Repor
tSource = report
The report is shown but the selection formula is being ignored so I suspect the formula is not being seen in form2.
What way should I have done this.
Also when I used VB 6.0 in conjunction with CR 8.5... I would write my own CR formula fields in the code rather than in the CR itself..
eg: header = "Expense Report for Joe's Auto Body"
CrystalReport1.Formulas(0)
= "Header=""" & header & """"
If I were to do this VB.net what would the code look like.
I find this forum very helpful...your time and help is much appreciated.
Start Free Trial