How can I pass parameter to crystal report in vb.net

I want to pass value of the textbox to crystal report how can I do that. can somebody write me code. thanks.

The code below should work for you. I got it from the following link:

There’s also instructions on how to add the parameter field to your crystal report at that link.


Dim param1Fields As New ParameterFields
            Dim param1Field As New ParameterField
            Dim param1Range As New ParameterDiscreteValue

            param1Field.ParameterFieldName = "sessiontype"
            param1Range.Value = txtSessionType.Text
            param1Field.CurrentValues.Add(param1Range)
            param1Fields.Add(param1Field)
            CrystalReportViewer1.ParameterFieldInfo = param1Fields


            CrystalReportViewer1.ReportSource = "CrystalReport.rpt"
            CrystalReportViewer1.Visible = True