you only need to pass it to datatable and dataset, i think it can be done with CR too (with same technique) but you'll need to change a few line of code because i never use CR, here is what i do with ReportViewer :
i add a DataGridView1 (i add two column for example) to Form1 and a Button too (Print Preview Button).
i add another Form (Form2) to hold ReportViewer.
still on Form2, i add a ReportViewer (set it to dock in parent container with clicking little arrow on right top corner of ReportViewer).
i add a DataSet (click Project>Add New Item.. on Data template choose DataSet).
i add a Report.rdlc (click Project>Add New Item.. on Reporting template choose Report or Report Wizard, i use Report).
go to your DataSet1, right click than choose Add>Data Table.
right click on DataTable1, and choose Add>Column or you can use ctrl+L, if you have two column on your DataGridView in Form1 than you have to add two column too on DataTable1 (amount of column on DataTable1 = amount of column on DataGridview1), name it what ever you want, default is DataColumn1, DataColumn2, and so on..).
go to your Form1, on Print Preview Button add this code :
Dim dtReport As New DataTable
Form2.ReportViewer1.LocalReport.DataSources.Item(0).Value = dtReport
Catch ex As Exception
go to your Report.rdlc, on top left corner click "New" then choose "Dataset..", on DataSource choose DataSet1 that you add before, click ok.
still on your Report.rdlc, add a Table from ToolBox, you can delete the header, left click on first cell, you will see small blue icon, click it and choose DataColumn1, DataColumn2 for second cell.
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...
OK, so HostGator for some reason no longer allows gcc/g++ access unless you have a Designated Server account, which is a lot of money to spend just to compile my "Hello World" program. Thus I figured I'd compile at home, then upload. Program is your regular old bare-bones Hello World ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.