我有一个名为“User”的类,代码:
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
Get
Return m_id
End Get
Set(ByVal value As String)
m_id = value
End Set
End Property
Public Property Name() As String
Get
Return m_user_name
End Get
Set(ByVal value As String)
m_user_name = value
End Set
End Property
End Class
我想报告所有用户的信息,所以我还有另一个名为“Users”的类,代码:
Public Class Users
inherits List(Of User)
Public Sub New()
'Query users' information from Table in Database
Add(New User(...)
End Sub
End Class
当我点击“打印”按钮时,它会弹出报告。我只有一个表格与报告查看器,但我有很多报告使用此表格与报告查看器。所以我这样编码:
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.DataSources.Add(rpt)
ReportViewer1.LocalReport.ReportEmbeddedResource = rpt.Name
ReportViewer1.RefreshReport()
End Sub
但它没有显示任何东西......请帮助我......我真的需要你的帮助.. 提前致谢