afternoon all hope someone can help,

i want to populate a report and print it directly without the user
hitting the print button.

i have this working in a diffrent project but for some reason it wont work in this one.

i get the error missing parameter, on the last line of my code
hope someone can help

Dim paramFields As New ParameterFields
    Dim paramField As New ParameterField
    Dim discreteVal As New ParameterDiscreteValue
    Private Sub IndlabelRep_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim rpt As New IndLabel() 'The report you created.
        Dim myConnection As SqlConnection
        Dim MyCommand As New SqlCommand()
        Dim myDA As New SqlDataAdapter()
        Dim myDS As New DataSet1() 'The DataSet you created


        paramField.ParameterFieldName = "BatchID"
        discreteVal.Value = indPrintIDV
        paramField.CurrentValues.Add(discreteVal)
        paramFields.Add(paramField)


        Try
            myConnection = New SqlConnection("Data Source=" & serverV & ";Initial Catalog=" & DatabaseV & ";Persist Security Info=True;User ID=" & UsernameV & ";Password=" & PasswordV & "")
            MyCommand.Connection = myConnection
            MyCommand.CommandText = "SELECT * FROM BatchDetail"
            MyCommand.CommandType = CommandType.Text
            myDA.SelectCommand = MyCommand
            myDA.Fill(myDS, "BatchDetail")

            rpt.SetDataSource(myDS)
            CrystalReportViewer1.ParameterFieldInfo = paramFields

            CrystalReportViewer1.ReportSource = rpt



            
        Catch Excep As Exception
            


        End Try
        rpt.PrintOptions.PrinterName = "HP Officejet Pro K850 Series"
        rpt.PrintToPrinter(1, False, 0, 0)

i think this has something to do with the parameters that i am sending to the report

see attatched pic

see attatched pic

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.