credream 发表于 2015-10-8 22:01:00

ActiveReports 9.0多次点击出现多个View画面,但 ActiveReports 4.0不会

1. ActiveReports 9.0连续点击button会出现多个View画面,但是在ActiveReports 4.0不会
猜测原因:由于ActiveReports 9.0,在出张票前会异步执行一下run方法,会出现线程不同步现象

参照:官方simple,进行这样的处理解决了:
CustomPreviewVS2013.vbproj

PreviewForm.vb的
Public Sub New(ByVal doc As Document.SectionDocument, ByVal parentForm As Form)
      MyBase.New()
      'Windows フォーム デザイナ サポートに必要です。
      InitializeComponent()
      MdiParent = parentForm
      arvMain.Document = doc
      Text = doc.Name
    End Sub

然后调用的时候:

Dim _viewerForm As New PreviewForm(rpt.Document, Me)
            _viewerForm.Show()
            rpt.Run(True)

run方法在show的后面进行的,可是我们这边用的是showdialog,没法执行run了,现在的做法是,先
   _viewerForm.Show()
            rpt.Run(True)
_viewerForm.hide()
_viewerForm.Showdialog()
这样处理的。。。
rpt.Run的运行原理是什么?
请问还有其他解决方案吗?,有没有更好的解决方案?



--------------------------------------------------------------------

frank.zhang 发表于 2015-10-9 12:17:00

您好,
AR9,在处理报表时,采用的方式是,使用创建一个新的SectionReport,
然后在Viewer1中LoadDocument这个报表。

最简单的做法是,在form的load事件中,进行处理。因为load只会触发一次。
Dim sectionReport As New SectionReport1()
Viewer1.LoadDocument(sectionReport)


我们看下run的这两个方式,主要是控制是否是阻塞还是异步的。如果没有特别需要可以不使用。
Run(Boolean) Starts report execution and optionally keeps any linked viewer control document in sync with the report's document.   
Run() Starts the report processing in blocked mode.   


您在上文提到的例子CustomPreviewVS2013,确实每次点击都会添加一个新的报表。这个是,程序中设置的,是为了显示多个报表。您可以根据您的实际情况进行修改。

frank.zhang 发表于 2015-10-19 17:36:00

为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢
http://gcdn.gcpowertools.com.cn/attachment.aspx?attachmentid=10062
页: [1]
查看完整版本: ActiveReports 9.0多次点击出现多个View画面,但 ActiveReports 4.0不会