I am using VS 2005 and the report viewer that comes along with this software...
I am developing an application and have declared and assigned values to variables. I've created my report and added the viewer to my form. When I execute the application everything is working the viewer sees my report and I am able to print.
I was wondering how I can use the values stored in my variables, and have them display in my report textboxes?
This is what I've got so far...
Assume:
- Form1 has textboxes
- Form2 has accessed these textbox values and assigned them to variables.
- The variables in Form2 are for test purposes assigned to label. When application is in running values for Form1 appear in the labels on Form2.
- A report has been created and has a textbox field named txtFName
- Report is named Employee_Profile.rpt
- Form2 has a report viewer named CrystalReportViewer1
source code:
Public Class Form1
Inherits System.Windows.Forms.Form
Private SeeForm2 As New Form2(Me)
Private Sub cmdPrint_Click(ByVal sender...)Handles cmdPrint.Click
SeeForm2.Show()
End Sub
End Class
Public Class Form2
Inherits System.Windows.Forms.Form
Private callingForm as Form1
Public Sub New(ByVal newCallingForm as Form1)
MyBase.New()
InitializeComponent()
callingForm = newCallingForm
End Sub
Private Sub Form2_Load(ByVal sender As...)Handles MyBase.Load
Dim FName As String
FName = callingForm.txtFName.Text
'Testing purposes to see if values has been passed
'Me.lblFName.Text = FName
Employee_Profile1.DataDefinitions.FormulaFields{txtFName as String} = FName
End Sub
End Class
Results from Build...
3 Errors
Error1 - Property access must assign to the property or use its value.
Error2 - Expression expected {
Error3 - Method arguements must be enclosed in paretheses.
I'm sure the solution is right in front of my face, I'm just having troubles seeing it right now! Any help on this source code or further explinations would be appreciated... Thanks so much to those that have taken the time to read this - and are able to offer solutions.