Results 1 to 7 of 7

Thread: [RESOLVED] [2008] Newbie to VS2008 Standard - Reports help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Location
    Manchester, England
    Posts
    255

    Resolved [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?
    At home - VB.NET 2005/2008 Express, Visual Web Developer 2005 Express
    At work - VS 2008 Standard (VB)
    .NET 2.0/3.5


    Visual Studio Express Learning Centre | How do I videos | MSDN VB Express Forum | MSDN VB Developer Centre

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [2008] Newbie to VS2008 Standard - Reports help

    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Location
    Manchester, England
    Posts
    255

    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.
    At home - VB.NET 2005/2008 Express, Visual Web Developer 2005 Express
    At work - VS 2008 Standard (VB)
    .NET 2.0/3.5


    Visual Studio Express Learning Centre | How do I videos | MSDN VB Express Forum | MSDN VB Developer Centre

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Location
    Manchester, England
    Posts
    255

    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.
    At home - VB.NET 2005/2008 Express, Visual Web Developer 2005 Express
    At work - VS 2008 Standard (VB)
    .NET 2.0/3.5


    Visual Studio Express Learning Centre | How do I videos | MSDN VB Express Forum | MSDN VB Developer Centre

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Location
    Manchester, England
    Posts
    255

    Re: [RESOLVED] [2008] Newbie to VS2008 Standard - Reports help

    Thanks for the advice.
    Much better option!
    At home - VB.NET 2005/2008 Express, Visual Web Developer 2005 Express
    At work - VS 2008 Standard (VB)
    .NET 2.0/3.5


    Visual Studio Express Learning Centre | How do I videos | MSDN VB Express Forum | MSDN VB Developer Centre

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