[RESOLVED] [2008] Newbie to VS2008 Standard - Reports help
Hello all,
I've just installed a copy of VS2008 Standard, and I'm looking at the MicrosoftReportViewer, and the ability to design a new report from it. To get started with it, I'm using the wizard.
What I'm finding is that the report doesn't display anything (data), although it is displaying the header text, and field names.
The way I'm firing the report is via a button on form MultipleLicenceResponse.vb. This form has a DataGridView (dgvResponseData) on it, which gets its data from tblResponseData.
This is opening LicenceReportPreview.vb via ...
Code:
Dim frmReport As New LicenceReportPreview
With frmReport
.Licence = "Display anything in this field for now"
.LicenceTable = tblResponseData ' Just to see if I can access this instead - which I can't!
End With
frmReport.ShowDialog()
The report wizard gets its object data from the LicenceReportPreview.vb class, where I'm selecting the LicenceReportPreview as the object and, for now, just the Licence property (which should be the string, "Display anything in this field for now") .... just to get something on the report!
What am I missing? Does anybody know of a good tutorial that I can follow which shows me how to get the contents of my table onto the report?
Re: [2008] Newbie to VS2008 Standard - Reports help
Re: [2008] Newbie to VS2008 Standard - Reports help
Thanks for your reply. I'm pulling my hair out with this one!
Almost everything that I find talks about creating reports where there is a fixed data source. I followed one of these examples, and it works fine.
However, I've created my DataTable at run time, and put it into a DataSet at run time.
How do I programmatically get this DataTable/DataSet into my report, and simply list the rows and columns? When I work with the snippets of code that I do find, which appear to be what I want, the report is usually blank.
Re: [2008] Newbie to VS2008 Standard - Reports help
I'm not sure that it's possible to do what you're talking about. A report has to be customised at design time for the data that it's going to display. How can that be done if you don't know what data it's going to get until run time? I'm not talking about the number of records and the data they contain, but you have to at least know the schema at design time. If you do know the schema at design time then you can design a DataSet at design time.
Re: [2008] Newbie to VS2008 Standard - Reports help
Thanks for your response again. I have had to cheat to get this to work!
I created the DataSet and DataTable in the designer.
The designed DataTable matches the structure of the table that I created programmatically - table name, column names, etc.
I then added my programmatically created table to the designed DataSet, and then cheated by programmatically renaming the designed DataTable to something else.
The .rdlc then uses the correctly named DataTable, and displays the contents in the ReportViewer.
Re: [RESOLVED] [2008] Newbie to VS2008 Standard - Reports help
Why can't you just populate the DataTable that's already in the DataSet with the data? If you're getting the DataTable whole from somewhere so it's not possible to populate the existing DataTable directly then just call DataTable.Merge to merge the data into it.
Re: [RESOLVED] [2008] Newbie to VS2008 Standard - Reports help
Thanks for the advice.
Much better option!