Hi,
1. How to print a report automatically through vb.net.For example if the print button is clicked the report has to automatically print, How can we do that??

2. How to retieve the rows one by one when the parameter value is entered in the text box and the columns or data based on that value has to be displayed in any ways, it can be list box or text box, combo box etc, So How can we retieve the field with the rows one by one associated to the value entered in th text box.
Can you please send the answer as soon as you can...


Thanks!

1.  'Try
        '    Me.ReportViewer1.RefreshReport()
        '    Dim BlankChecklist As New frmblankPictureSheet
        '    Dim frmblankPictureSheet As New PrintDocument
        '    frmblankPictureSheet.Print()

        'Catch ex As Exception

        '    MsgBox(ex.Message)
        'End Try

But I give this codee, I am getting the handle is invalid error


2. In the below example I gave text boxes and cmb boxes for displaying to see any thing might work, but I see only the first row in either of those??

Dim dr As SqlDataReader
        Dim enterIT As Double
        enterIT = Convert.ToDouble(txtIT.Text)
        Try
            sqlconn.Open()
            Dim sqlcmd As New SqlCommand()
            sqlcmd.Connection = sqlconn
            sqlcmd.CommandType = CommandType.StoredProcedure
            sqlcmd.CommandText = "procQAHoldPuller1"
            RichTextBox1.Text = ""
            'Txtcat.Text = ""
            'Txtqty.Text = ""
            'Txtdesc.Text = ""
            'Txtlot.Text = ""
            'Txtloc.Text = ""
            'Txtbra.Text = ""
            'Txtdra.Text = ""
            'Txtaut.Text = ""
            'Txtcomm.Text = ""
            'ComboBox1.Text = ""
            'ComboBox2.Text = ""
            'ComboBox3.Text = ""
            'ComboBox4.Text = ""
            'ComboBox5.Text = ""
            'ComboBox6.Text = ""
            'ComboBox7.Text = ""
            'ComboBox8.Text = ""
            'ComboBox9.Text = ""
            sqlcmd.Parameters.AddWithValue("@EnterIT", enterIT).Direction = ParameterDirection.Input
            dr = sqlcmd.ExecuteReader()
            If (dr.Read()) Then
                ' need to assign the text box values
                RichTextBox1.Text = (dr("ILLITM").ToString())
                'Txtqty.Text = (dr("ILTRQT").ToString())
                'Txtdesc.Text = (dr("IMDSC1").ToString())
                'Txtlot.Text = (dr("ILLOTN").ToString())
                'Txtloc.Text = (dr("ILLOCN").ToString())
                'Txtbra.Text = (dr("Branch").ToString())
                'Txtdra.Text = (dr("IMDRAW").ToString())
                'Txtaut.Text = (dr("ILUSER").ToString())
                'Txtcomm.Text = (dr("ILTREX").ToString())
                'ComboBox1.Text = (dr("ILLITM").ToString())
                'ComboBox2.Text = (dr("ILTRQT").ToString())
                'ComboBox3.Text = (dr("IMDSC1").ToString())
                'ComboBox4.Text = (dr("ILLOTN").ToString())
                'ComboBox5.Text = (dr("ILLOCN").ToString())
                'ComboBox6.Text = (dr("Branch").ToString())
                'ComboBox7.Text = (dr("IMDRAW").ToString())
                'ComboBox8.Text = (dr("ILUSER").ToString())
                'ComboBox9.Text = (dr("ILTREX").ToString())
                Dim ds As New DataSet()
                Dim da As New SqlDataAdapter(sqlcmd)
                da.Fill(ds)

            End If
            'MessageBox.Show(LstvwCat.Text & " " & (dr("ILLITM").ToString()))
            dr.Close()
            sqlconn.Close()
        Catch exp As Exception
            MessageBox.Show(exp.Message)
        End Try
    End Sub

    Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
        Dim sqlconn As New SqlClient.SqlConnection("Data Source=PSFTENT;Initial Catalog=Ops_Development;User ID=svcSQL;Password= D@T@Base")
        'Dim dr As SqlDataReader
        Dim enterIT As Double
        enterIT = Convert.ToDouble(txtIT.Text)
        Try
            sqlconn.Open()
            Dim sqlcmd As New SqlCommand()
            sqlcmd.Connection = sqlconn
            sqlcmd.CommandType = CommandType.StoredProcedure
            sqlcmd.CommandText = "procQAHoldPuller1"
            'Txtcat.Text = ""
            'Txtqty.Text = ""
            'Txtdesc.Text = ""
            'Txtlot.Text = ""
            'Txtloc.Text = ""
            'Txtbra.Text = ""
            'Txtdra.Text = ""
            'Txtaut.Text = ""
            'Txtcomm.Text = ""
            'ComboBox1.Text = ""
            'ComboBox2.Text = ""
            'ComboBox3.Text = ""
            'ComboBox4.Text = ""
            'ComboBox5.Text = ""
            'ComboBox6.Text = ""
            'ComboBox7.Text = ""
            'ComboBox8.Text = ""
            'ComboBox9.Text = ""
            'sqlcmd.Parameters.AddWithValue("@EnterIT", enterIT).Direction = ParameterDirection.Input
            'dr = sqlcmd.ExecuteReader()
            'If (dr.Read()) Then
            '' need to assign the text box values
            'Txtcat.Text = (dr("ILLITM").ToString())
            'Txtqty.Text = (dr("ILTRQT").ToString())
            'Txtdesc.Text = (dr("IMDSC1").ToString())
            'Txtlot.Text = (dr("ILLOTN").ToString())
            'Txtloc.Text = (dr("ILLOCN").ToString())
            'Txtbra.Text = (dr("Branch").ToString())
            'Txtdra.Text = (dr("IMDRAW").ToString())
            'Txtaut.Text = (dr("ILUSER").ToString())
            'Txtcomm.Text = (dr("ILTREX").ToString())
            'ComboBox1.Text = (dr("ILLITM").ToString())
            'ComboBox2.Text = (dr("ILTRQT").ToString())
            'ComboBox3.Text = (dr("IMDSC1").ToString())
            'ComboBox4.Text = (dr("ILLOTN").ToString())
            'ComboBox5.Text = (dr("ILLOCN").ToString())
            'ComboBox6.Text = (dr("Branch").ToString())
            'ComboBox7.Text = (dr("IMDRAW").ToString())
            'ComboBox8.Text = (dr("ILUSER").ToString())
            'ComboBox9.Text = (dr("ILTREX").ToString())
            Dim ds As New DataSet()
            Dim da As New SqlDataAdapter(sqlcmd)
            da.Fill(ds)

            'End If
            'MessageBox.Show(LstvwCat.Text & " " & (dr("ILLITM").ToString()))
            'dr.Close()
            sqlconn.Close()
            'sqlconn.Close()
            Dim i As Integer
            For i = 0 To (ds.Tables(0).Rows.Count - 1)
            Next
            'DataGridView1.Ad(Convert.ToString(ds.Tables(0).Rows(i)(0)))
            'Next
        Catch exp As Exception
            MessageBox.Show(exp.Message)
        End Try
    End Sub
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.