Question

I want to display the current user name in a "Prepared By" Field(Parameter Field) of a crystal report using vb.net. How can i achieve that? I have the current username in a string variable. Now how can i link it to the Prepared By field?

Please provide me some input.

Thanks in Advance.

Was it helpful?

Solution

Give this a try, you must have the field in your report first though...

 Private Sub Form2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
  Dim Report1 As New CrystalReport1

  Report1.SetParameterValue("crTextBox", Form1.TextBox1.Text)
  CrystalReportViewer1.ReportSource = Report1
 End Sub

In the SetParameterValue you specify the field name from your report and the field you want from your form or whatever it maybe; in your case your variable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top