Link to home
Create AccountLog in
Avatar of EYoung
EYoungFlag for United States of America

asked on

How pass parameters in VB.net 2008 using the CrystalReportViewer?

I am new to VB.net 2008 (Windows forms) but have done a lot of applications in VB6.  I am writing a new vb.net 2008 application and I want to call a Crystal Reports 2008 (Vendor_Master.rpt) that I have included in my application.  In VB6, the way I passed parameters was as follows:

Dim Report As dsrVendor_Master
Set Report = New dsrVendor_Master
Report.EnableParameterPrompting = False
Report.ParameterFields(1).AddCurrentValue mReport_Sort_Order_Parm
Report.ParameterFields(2).AddCurrentValue mReport_Dollars_Parm

Now in VB.net 2008 I don't know how to pass parameters to a Crystal Report using the CrystalReportViewer.  Below is the code I currently am trying in the application but it errors out:

Public Class crvVendor_Master
    Private Sub crvVendor_Master_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
        CrystalReportViewer1.ParameterFieldInfo(1).Add(mReport_Sort_Order_Parm)
        CrystalReportViewer1.ParameterFieldInfo(2).Add(mReport_Dollars_Parm)
        CrystalReportViewer1.ShowLogo = False
        CrystalReportViewer1.Zoom(80)
    End Sub
End Class


Thank you for any help.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

What kind of errors are you getting?
Avatar of EYoung

ASKER

Just a variety.  Can someone provide a simple example of passing a couple of parms from the CRV in VB.net 2008 to a CR 2008 report?  Thanks
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of EYoung

ASKER

Excellent.  That worked perfectly.  Thank you again.
Avatar of EYoung

ASKER

mlmcc,

I have started a new question that I would appreciate your help with.  Here is the link:
https://www.experts-exchange.com/questions/24080419/Help-with-VB-net-2008-concepts.html

Regards,
EYoung