Mail中有朋友问到,顺便写出来.
VB+水晶报表9,这个还是很简单的,自带事件
Private Sub CRViewer91_NextPageButtonClicked(UseDefault As Boolean)
Call MsgBox("向后换页")
End Sub
Private Sub CRViewer91_LastPageButtonClicked(UseDefault As Boolean)
Call MsgBox("最后一页")
End Sub
Private Sub CRViewer91_FirstPageButtonClicked(UseDefault As Boolean)
Call MsgBox("第一页")
End Sub
Private Sub CRViewer91_PrevPageButtonClicked(UseDefault As Boolean)
Call MsgBox("向前一页")
End Sub
VS.Net2003自带的,好象没有直接的事件,
不过变通一下可以获得的,
先定义两个全局变量
Public LastPageNum As Int16 '上一页的页码
Public NowPageNum As Int16 '当前页的页码
使用如下事件技巧性获得页面变更事件,
Private Sub CrystalReportViewer1_Navigate(ByVal source As Object, ByVal e As CrystalDecisions.Windows.Forms.NavigateEventArgs) Handles CrystalReportViewer1.Navigate
'取得当前页码
NowPageNum = CrystalReportViewer1.GetCurrentPageNumber
'如果是第一次加载,则退出
If NowPageNum = -1 Then
Exit Sub
End If
'如果是换页
If LastPageNum <> NowPageNum Then
Call MsgBox("换页了")
End If
'更换变量的值
LastPageNum = NowPageNum
End Sub
本文地址:http://com.8s8s.com/it/it19807.htm