Click here to Skip to main content
15,885,278 members
Articles / Desktop Programming / Windows Forms

One to Many Reports with VS.NET 2005 (2.0) Report Designer

Rate me:
Please Sign up or sign in to vote.
4.69/5 (58 votes)
9 May 2006CPOL4 min read 418.4K   3.2K   135  
A tutorial on how to create a hierarchical (1:m) RDLC report in Visual Studio .NET 2005 (local mode).
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class FormFiltered
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim ReportDataSource1 As Microsoft.Reporting.WinForms.ReportDataSource = New Microsoft.Reporting.WinForms.ReportDataSource
        Me.NorthwindDataSet = New WindowsApplication4.NorthwindDataSet
        Me.ReportViewer1 = New Microsoft.Reporting.WinForms.ReportViewer
        Me.CategoriesBindingSource = New System.Windows.Forms.BindingSource(Me.components)
        Me.CategoriesTableAdapter = New WindowsApplication4.NorthwindDataSetTableAdapters.CategoriesTableAdapter
        Me.CategoriesComboBox = New System.Windows.Forms.ComboBox
        Me.LabelCategory = New System.Windows.Forms.Label
        Me.Sales_by_Category_FilteredTableAdapter = New WindowsApplication4.NorthwindDataSetTableAdapters.Sales_by_Category_FilteredTableAdapter
        Me.Sales_by_Category_FilteredBindingSource = New System.Windows.Forms.BindingSource(Me.components)
        CType(Me.NorthwindDataSet, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.CategoriesBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.Sales_by_Category_FilteredBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'NorthwindDataSet
        '
        Me.NorthwindDataSet.DataSetName = "NorthwindDataSet"
        Me.NorthwindDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
        '
        'ReportViewer1
        '
        Me.ReportViewer1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        ReportDataSource1.Name = "NorthwindDataSet_Sales_by_Category"
        ReportDataSource1.Value = Me.Sales_by_Category_FilteredBindingSource
        Me.ReportViewer1.LocalReport.DataSources.Add(ReportDataSource1)
        Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "WindowsApplication4.Report1.rdlc"
        Me.ReportViewer1.Location = New System.Drawing.Point(0, 24)
        Me.ReportViewer1.Name = "ReportViewer1"
        Me.ReportViewer1.Size = New System.Drawing.Size(727, 467)
        Me.ReportViewer1.TabIndex = 0
        '
        'CategoriesBindingSource
        '
        Me.CategoriesBindingSource.DataMember = "Categories"
        Me.CategoriesBindingSource.DataSource = Me.NorthwindDataSet
        '
        'CategoriesTableAdapter
        '
        Me.CategoriesTableAdapter.ClearBeforeFill = True
        '
        'CategoriesComboBox
        '
        Me.CategoriesComboBox.DataSource = Me.CategoriesBindingSource
        Me.CategoriesComboBox.DisplayMember = "CategoryName"
        Me.CategoriesComboBox.Location = New System.Drawing.Point(69, 2)
        Me.CategoriesComboBox.Name = "CategoriesComboBox"
        Me.CategoriesComboBox.Size = New System.Drawing.Size(190, 21)
        Me.CategoriesComboBox.TabIndex = 1
        Me.CategoriesComboBox.ValueMember = "CategoryID"
        '
        'LabelCategory
        '
        Me.LabelCategory.AutoSize = True
        Me.LabelCategory.Location = New System.Drawing.Point(12, 5)
        Me.LabelCategory.Name = "LabelCategory"
        Me.LabelCategory.Size = New System.Drawing.Size(49, 13)
        Me.LabelCategory.TabIndex = 2
        Me.LabelCategory.Text = "Category"
        '
        'Sales_by_Category_FilteredTableAdapter
        '
        Me.Sales_by_Category_FilteredTableAdapter.ClearBeforeFill = True
        '
        'Sales_by_Category_FilteredBindingSource
        '
        Me.Sales_by_Category_FilteredBindingSource.DataMember = "Sales by Category Filtered"
        Me.Sales_by_Category_FilteredBindingSource.DataSource = Me.NorthwindDataSet
        '
        'FormFiltered
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(727, 491)
        Me.Controls.Add(Me.LabelCategory)
        Me.Controls.Add(Me.CategoriesComboBox)
        Me.Controls.Add(Me.ReportViewer1)
        Me.Name = "FormFiltered"
        Me.Text = "FormFiltered"
        CType(Me.NorthwindDataSet, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.CategoriesBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.Sales_by_Category_FilteredBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents ReportViewer1 As Microsoft.Reporting.WinForms.ReportViewer
    Friend WithEvents NorthwindDataSet As WindowsApplication4.NorthwindDataSet
    Friend WithEvents CategoriesBindingSource As System.Windows.Forms.BindingSource
    Friend WithEvents CategoriesTableAdapter As WindowsApplication4.NorthwindDataSetTableAdapters.CategoriesTableAdapter
    Friend WithEvents CategoriesComboBox As System.Windows.Forms.ComboBox
    Friend WithEvents LabelCategory As System.Windows.Forms.Label
    Friend WithEvents Sales_by_Category_FilteredBindingSource As System.Windows.Forms.BindingSource
    Friend WithEvents Sales_by_Category_FilteredTableAdapter As WindowsApplication4.NorthwindDataSetTableAdapters.Sales_by_Category_FilteredTableAdapter

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer Kiefer Consulting
United States United States
Sacramento, CA based Senior .Net and SharePoint Solution Architect for Kiefer Consulting
(1-800-794-1928)
B.S. in Mathematics from UCDavis
.NET Wizard - Experts-Exchange
MCSD, MCTS: MOSS 2007 Config

Some of the bigger questions:
1. What is the meaning of my life?
To satisfy the purpose of your creator(s). (Meaning must derive from purpose. Those who create you, give you meaning.)

2. Who is my creator?
Ultimately, God is your creator. God designed and created the universe and everything in it. You and others in your life can also be a part of your creation, overriding or furthering God's purpose.

3. What is God's purpose for me?
To love and be loved by your creator and others and to enjoy the life you've been given.
This can be distinguished two ways.
a. Use your built in common sense (morality/feelings)
b. Use the creator's handbook. Fortunately our creator did not abandon us. He is with us now and even lived and died as one of us. Check out his biography in "The Bible"

Note on free-will vs. predetermination:
God exists outside the constraints of time. He exists at every point in time simultaneously and knew of your birth and every decision you will/have made. But this does not mean God predetermined any of it. Pre and post are time related concepts that do not apply to God. God always has been and always will be. He determines our universe to exist, gives it the parameters of natural law, and allows us to make our own way through it (free-will). Note that these are all present tense, it would be more appropriate to use past, present, and future tense combined. God's purpose is for us to love him and one another. But a prerequisite of love is the free-will to love. So even though God wants us to love him/others, he can not ensure it. He can, however, help us if we allow him to. A miracle is God modifying natural parameters in response to human will.

Comments and Discussions