Start New Discussion within our Software Development Community

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

    Login_Information_Report.viewerloginfo.ReportSource = report

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

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
This article has been dead for over six months. Start a new discussion instead.