找回密码
 立即注册

QQ登录

只需一步,快速开始

credream

中级会员

110

主题

296

帖子

828

积分

中级会员

积分
828

活字格认证

credream
中级会员   /  发表于:2015-10-8 22:01  /   查看:3583  /  回复:2
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的运行原理是什么?
请问还有其他解决方案吗?,有没有更好的解决方案?



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

2 个回复

倒序浏览
frank.zhang
社区贡献组   /  发表于:2015-10-9 12:17:00
沙发
您好,
AR9,在处理报表时,采用的方式是,使用创建一个新的SectionReport,
然后在Viewer1中LoadDocument这个报表。

最简单的做法是,在form的load事件中,进行处理。因为load只会触发一次。
  1. Dim sectionReport As New SectionReport1()
  2. 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
板凳
为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部