正在阅读:.NET基础学习:经典水晶报表设计三则.NET基础学习:经典水晶报表设计三则

2004-02-14 09:34 出处:PConline 作者:haibodotnet/CSDN 责任编辑:linjixiong

  7. 水晶报表排序编程实例

  Dim crReportDocument As ReportDocument

  Public Sub changeSortField(mySortFld As String, mySortDir As String)

  Dim crSortField As SortField

  Dim crSortDirection As SortDirection

  Dim crDatabaseFieldDefinition As DatabaseFieldDefinition

  For Each crSortField In crReportDocument.DataDefinition.SortFields

  If crSortField.Field.Name.ToString = mySortFld Then

  crDatabaseFieldDefinition = crReportDocument.Database.Tables(0).Fields(mySortFld.ToString)

  crSortField = crReportDocument.DataDefinition.SortFields(0)

  crSortField.Field = crDatabaseFieldDefinition

  If mySortDir = "Ascending" Then

  crSortField.SortDirection = SortDirection.AscendingOrder

  Else

  crSortField.SortDirection = SortDirection.DescendingOrder

  End If

  End If

  Next

  CrystalReportViewer1.ReportSource = crReportDocument

  End Sub
键盘也能翻页,试试“← →”键

相关文章

关注我们

最新资讯离线随时看 聊天吐槽赢奖品