I'm completely clueless to this as I have never used crystal reports before. So I want to use a textbox to pass values into my crystal report so basically only those I inputted into my textbox will be read and be outputted into my crystal report.

Here is my code so far:

Dim report As New crystalreportloginfo
    Dim adapter As New SqlDataAdapter("select * from log_information where account_id='" & txtsearchaccountid.Text & "'", connection)
    Dim datatable As New DataTable
    adapter.Fill(datatable)

    report.SetDataSource(datatable)
    Login_Information_Report.viewerloginfo.ReportSource = report
    Login_Information_Report.viewerloginfo.RefreshReport()

Hope this will help you

Dim cryRpt As New ReportDocument


        CrystalReportViewer1.SelectionFormula = "{Product_Details.P_Id}= '" & Textbox1.Text & "'"
        cryRpt.Load("G:\Sales and inventory system\Product.rpt")
        CrystalReportViewer1.ReportSource = cryRpt
        CrystalReportViewer1.Refresh()

hi Iamkenny?
are you trying to load data from a database into a textbox then output it on a crystal report or you just want to output what you've type in the textbox?

I have given the way to insert through database to the report K-Dave to do you know how to insert data through textbox directly to crystal report.

I used this coding which had been in this forum sometime a back ,but i got error in 9th line as"Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))"

Dim cryRpt As New ReportDocument
        Dim report As New CrystalReport1

        Dim crParameterFieldDefinitions As ParameterFieldDefinitions
        Dim crParameterFieldDefinition As ParameterFieldDefinition
        Dim crParameterValues As New ParameterValues
        Dim crParameterDiscreteValue As New ParameterDiscreteValue
        crParameterDiscreteValue.Value = TextBox1.Text
        crParameterFieldDefinitions = report.DataDefinition.ParameterFields()
        crParameterFieldDefinition = crParameterFieldDefinitions.Item("@Parameter")
        crParameterValues = crParameterFieldDefinition.CurrentValues
        crParameterValues.Clear()
        crParameterValues.Add(crParameterDiscreteValue)
        crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
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.