水晶报表刷新出错!!!

Litao81 2003-08-30 03:32:30
CRViewer1.Refresh
这个语句刷新时,有时会出错窗口如下:

实时错误'-2147417848(80010108)':
对象'Refresh'的方法'ICrystalReportViewer3'失败

点击调试后,有出以下错误

实时错误'-2147467259(80004005)':
控件正在下载数据.

我感觉是不是刷新太快,报表动态添加的字段太多,来不及刷新啊,
大家帮我看一下,好吗?
...全文
34 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhuixing 2003-09-15
  • 打赏
  • 举报
回复
字段刷新用CRViewer1.Refresh
重新设报表CRViewer1.ReportSource = Report
CRViewer1.ViewReport 就行
Cocoky 2003-09-02
  • 打赏
  • 举报
回复
Set Report = New CrystalReport3 '重新设一下
CRViewer1.ReportSource = Report
CRViewer1.ViewReport '预览报表

Dim j As Integer ' j 循环写入的变量
Dim strn As Integer

While StrWidth(j, 0) <> ""
strn = StrWidth(j, 0)

Call Refresh1(strn, j) '此处就是重新设每个控件的位置

j = j + 1
Wend
Exit Sub
Else
Exit Sub
End If
End If
Next
End If
CRViewer1.Refresh ''''出错处
改为:
Set Report = New CrystalReport3 '重新设一

Dim j As Integer ' j 循环写入的变量
Dim strn As Integer

While StrWidth(j, 0) <> ""
strn = StrWidth(j, 0)

Call Refresh1(strn, j) '此处就是重新设每个控件的位置

j = j + 1
Wend
Exit Sub
Else
Exit Sub
End If
End If
Next
CRViewer1.ReportSource = Report
CRViewer1.ViewReport '预览报表
End If
因为你CRViewer1.ViewReport 时,CRViewer1正在下载数据,
而程序接着往下执行,当执行到CRViewer1.Refresh时数据还未下载好所以会出错!
Litao81 2003-09-02
  • 打赏
  • 举报
回复
If str(n) = True Then '
—————————————————————————————— 中间这都是计算位置的
Dim i As Integer
Dim x As Integer
For i = 0 To UBound(StrWidth) 'i 查找位置的变量
If Val(StrWidth(i, 0)) = n Then
If StrWidth(i, 3) <> Txtname.Text Or StrWidth(i, 2) <> TxtWidth.Text * 100 Then
x = i
StrWidth(x, 0) = n
'StrWidth(x, 1) = IntLeft 起始位置不变
StrWidth(x, 2) = TxtWidth.Text * 100
StrWidth(x, 3) = Txtname.Text

For x = x + 1 To UBound(StrWidth)
If StrWidth(x, 0) = "" Then
IntLeft = StrWidth(x - 1, 1) + StrWidth(x - 1, 2) + 100
Exit For
End If
StrWidth(x, 1) = StrWidth(x - 1, 1) + StrWidth(x - 1, 2) + 100

Next
————————————————————————————————————————
Set Report = New CrystalReport3 '重新设一下
CRViewer1.ReportSource = Report
CRViewer1.ViewReport '预览报表

Dim j As Integer ' j 循环写入的变量
Dim strn As Integer

While StrWidth(j, 0) <> ""
strn = StrWidth(j, 0)

Call Refresh1(strn, j) '此处就是重新设每个控件的位置

j = j + 1
Wend
Exit Sub
Else
Exit Sub
End If
End If
Next
End If
CRViewer1.Refresh ''''出错处
End If


Sub Refresh1(n1 As Integer, j1 As Integer)

Report.Sections(2).ReportObjects(n1 + 1).Suppress = False
Report.Sections(3).ReportObjects(n1 + 1).Suppress = False

Report.Sections(2).ReportObjects(n1 + 1).SetText StrWidth(j1, 3)
Report.Sections(2).ReportObjects(n1 + 1).Width = StrWidth(j1, 2)
Report.Sections(2).ReportObjects(n1 + 1).Left = StrWidth(j1, 1)
Report.Sections(3).ReportObjects(n1 + 1).Width = StrWidth(j1, 2)
Report.Sections(3).ReportObjects(n1 + 1).Left = StrWidth(j1, 1)
....
end sub
Cocoky 2003-09-01
  • 打赏
  • 举报
回复
你把代码贴出来看看!!
Litao81 2003-09-01
  • 打赏
  • 举报
回复
怎么解决啊?再说我也只是添加完控件后刷新啊,怎么取消了
Cocoky 2003-09-01
  • 打赏
  • 举报
回复
实时错误'-2147467259(80004005)':
控件正在下载数据.
这个错误是因为预览窗体正在加载数据时被你取消了

上一个错误我不知道
showflow 2003-08-31
  • 打赏
  • 举报
回复
加个doevent看行不行,或者多加几个

809

社区成员

发帖
与我相关
我的任务
社区描述
VB 多媒体
社区管理员
  • 多媒体
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧