用label可以显示出分页的内容,但怎么把分页的内容显示在MSHFlexGrid上呢?
解决方案 »
- VB中如何启用禁用系统设备
- 为什么在VB下开发的OCX控件在网页中不正常?
- treeview控件中如何判断点击的是父结点还是字结点???????
- 怎么提取文本里的内容发送到串口上?
- 如何返回一个字符串,在线等待!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 收购:对了解,学习,制作,应用用户控件有帮助的书籍,连接,收藏,文档等等
- Access查詢中數據刷新問題?
- 100分索要一个VB里DATAREPORT的例子(是DAO3.6的)
- 急!在线(MSFlexGrid)
- 如何快速的填充一long类型的数组的每个元素为一固定值啊?
- 求一条SQL语句,查询数据库的第m到n条记录?
- 请教!
'---------分页显示过程---------------------
Public Function EveryRowDisplay(ByRef MSHFGrd As MSHFlexGrid, ByRef sql As String, ByRef formatStr As String, ByVal rowSum As Integer, ByVal colSum As Integer) As String
'''''''''''''''''''返回数据总页数Dim n As Integer
Opendb
rs.CursorLocation = adUseClient
Debug.Print sql
rs.Open sql, Cn, 1, 2
If Not rs.EOF Then
Dim pageSum As Integer '''''取总页数
Dim Rcounts As Integer ''''当数据总数小于设定行时取得显示数据的最大行
Dim RsP As Integer '''''获得当前纪录的位置 rs.PageSize = rowSum
Rcounts = rs.RecordCount
If (Rcounts / rowSum) - 1 > 0 Then
pageSum = ((Rcounts - 1) \ rowSum) + 1
Else
pageSum = 1
End If
If StartP > rs.PageCount Then
StartP = rs.PageCount
End If
If StartP < 1 Then
StartP = 1
End If
rs.AbsolutePage = StartP
MSHFGrd .Clear
With MSHFGrd
.formatString = formatStr
.Cols = rs.Fields.Count
.Rows = rowSum + 1
For i = 1 To rowSum
For j = 0 To colSum - 1
.TextMatrix(i, j) = rs.Fields(j) & ""
Next
rs.MoveNext
If rs.EOF Then '判断记录是否了到最后一条
GoTo DSPend
End If
Next
End With
Else
MSHFGrd .Clear
MSHFGrd .formatString = formatStr
End IfDSPend:
rs.Close
Cn.Close
Set rs = Nothing
Set Cn = Nothing
If pageSum = 0 Then
EveryRowDisplay= 0 & "/" & pageSum
Else
EveryRowDisplay= StartP & "/" & pageSum End If
End Function