How to Create Report Viewer Binding to Object in VB.NET RRS feed

  • Question

  • I have Class named "User", code:

         Public Class User

            Private m_id As String
            Private m_user_name As String

            Public Sub New(ByVal id As String, ByVal name As String, ByVal pwd As String)
              m_id = id
              m_user_name = name
              m_pwd = pwd
            End Sub

            Public Property Id() As String
                  Return m_id
              End Get
              Set(ByVal value As String)
                  m_id = value
              End Set
            End Property

            Public Property Name() As String
                  Return m_user_name
              End Get
              Set(ByVal value As String)
                  m_user_name = value
              End Set
            End Property

         End Class
    And I want to report all the user's information, so I also have another class named "Users", code:

         Public Class Users
               inherits List(Of User)
               Public Sub New()
                      'Query users' information from Table in Database
                      Add(New User(...)
               End Sub
         End Class

    When I clicked on "Print" button, it will pop up the report. I have only one Form with Report Viewer, but I have a lot of reports using this Form with Report Viewer. so I code like this:

         Public Class Form1
                Private Sub Form1_Load(...) Handles MyBase.Load

                    Dim bs As New BindingSource
                    bs.DataSource= New Users
                    Dim rpt As New Microsoft.Reporting.WinForms.ReportDataSource
                    rpt.Name = "Report_User"
                    rpt.Value = bs
                    ReportViewer1.LocalReport.ReportEmbeddedResource = rpt.Name
                End Sub

    But it doesn't show anything... Please help me... I really need your help..
    Thanks in advance
    • Moved by Mark Liu-lxf Thursday, November 29, 2012 2:48 AM (From:Visual Basic General)
    Wednesday, November 28, 2012 6:02 AM


All replies

  • Hi Kimleng,

    Thanks for you post.

    Microsoft provides a special forum to deal with report issue. For better support, I will move this thread to Visual Studio Report Controls forum. It will cost a little time to involve the members in this forum. I appreciate your patience.

    Sorry for any inconvenience and have a nice day.

    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, November 29, 2012 2:47 AM
  • Now I can solve it reference
    • Marked as answer by kimleng Saturday, December 1, 2012 7:43 AM
    Saturday, December 1, 2012 1:56 AM