Results 1 to 3 of 3

Thread: putting Listview items in datatable. . . .

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2011
    Posts
    137

    putting Listview items in datatable. . . .

    I have this code and i want to put all my items in listview to put it in datatable. . . .but how can i do that how can i populate datatable with listview??Im new with listview. . . .can anyone elp me with this. . . .


    Code:
     Dim dt As New DataTable
            With dt
                .Columns.Add("Quantity")
                .Columns.Add("Description")
                .Columns.Add("Price")
                .Columns.Add("Total")
            End With
     dt.Rows.Add(ListView1.Items("Quantity"), ListView1.Items("Description"), ListView1.Items("Price"), ListView1.Items("Total"))
    
            Dim rptForm As New CrystalDecisions.CrystalReports.Engine.ReportDocument
            Dim rpt As New crreceipt()
            Dim T1, T2, T3, T4 As CrystalDecisions.CrystalReports.Engine.TextObject
            rpt.SetDataSource(dt)
    
            frmreceipt.CrystalReportViewer1.ReportSource = rpt
            rptForm = rpt    'rpt is your report object

  2. #2
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: putting Listview items in datatable. . . .

    its simple really. to add rows/items in your data table, simply iterate through the items (your source) and add the row of data to your DataTable, as you currently are... dt.Rows.Add(....)

    what problems are you facing?

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2011
    Posts
    137

    Re: putting Listview items in datatable. . . .

    can u show me how to do it??i cant add the value in the datatable im using listview. . . .i want to populate the datatable with the listview item. . . .so dat i can pass the datatable in the crystal report. . . .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width