以上问题将在以下情况发生: -
第1步:打开报告表格
第2步:生成报告并向右滚动
第3步:关闭报告表
第4步:重新打开报告表
如您所见,左侧的某些列缺失,唯一可以避免此问题的方法是在关闭表单之前必须将其向左滚动,否则需要重新启动应用程序。同样的事情发生在垂直滚动条上,如果关闭表单而不将其滚动回顶部,则在重新打开表单时会丢失一些行。
*最大化或调整表单大小也无法修复它
以下是报告表格编码
Imports MySql.Data.MySqlClient
Imports Microsoft.Reporting
Public Class Report
Private Sub Report_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.scr_report.RefreshReport()
End Sub
Private Sub dtp_from_ValueChanged(sender As Object, e As EventArgs) Handles dtp_from.ValueChanged, dtp_to.ValueChanged
Dim currDTP As DateTimePicker = sender
dtp_from.Checked = currDTP.Checked
dtp_to.Checked = currDTP.Checked
End Sub
Private Sub btn_generate_Click(sender As Object, e As EventArgs) Handles btn_generate.Click
Dim query As String = ""
Select Case cb_report.Text
Case "xxx"
'some query
End Select
Dim cmd As New MySqlCommand(query, conn)
Dim da As New MySqlDataAdapter(cmd)
Dim ds As New DataSet1
da.Fill(ds.Tables(0))
scr_report.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
scr_report.LocalReport.DataSources.Clear()
scr_report.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", ds.Tables(0)))
scr_report.RefreshReport()
Me.Text = $"Report ({cb_report.Text})"
End Sub
End Class
知道如何解决这个问题吗?