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
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?
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. . . .