当点击mshflexgrid列头排序,一共有10列,不知道为何点击单价一列就是提示错误,代码如下
Private Sub grdMingxi_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
SUBMSHFgrid_Sort grdMingxi, x, yEnd Sub
Public Sub SUBMSHFgrid_Sort(FLGrid As MSHFlexGrid, x As Single, y As Single)
Dim dblRowHeight As Double
Dim dblColWidth As Double
Dim i As Integer
Dim AA As Integer
dblColWidth = 0
With FLGrid
If .TextMatrix(1, 1) = "" Then Exit Sub dblRowHeight = .CellHeight If y <= dblRowHeight Then .Row = 0 For i = 0 To .Cols - 1 .Col = i
dblColWidth = dblColWidth + .CellWidth If dblColWidth > x Then
.Tag = IIf(Val(.Tag) = 1, 2, 1)
For j = 1 To .Rows - 1
.TextMatrix(j, 1) = j
Next j
Exit Sub
End If Next i .SelectionMode = flexSelectionByRow
.FocusRect = flexFocusLight
.Row = 1
End If End With
End Sub
Private Sub grdMingxi_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
SUBMSHFgrid_Sort grdMingxi, x, yEnd Sub
Public Sub SUBMSHFgrid_Sort(FLGrid As MSHFlexGrid, x As Single, y As Single)
Dim dblRowHeight As Double
Dim dblColWidth As Double
Dim i As Integer
Dim AA As Integer
dblColWidth = 0
With FLGrid
If .TextMatrix(1, 1) = "" Then Exit Sub dblRowHeight = .CellHeight If y <= dblRowHeight Then .Row = 0 For i = 0 To .Cols - 1 .Col = i
dblColWidth = dblColWidth + .CellWidth If dblColWidth > x Then
.Tag = IIf(Val(.Tag) = 1, 2, 1)
For j = 1 To .Rows - 1
.TextMatrix(j, 1) = j
Next j
Exit Sub
End If Next i .SelectionMode = flexSelectionByRow
.FocusRect = flexFocusLight
.Row = 1
End If End With
End Sub
解决方案 »
- 怎么解决高版本office环境下开发的vba程序在低版本的环境下正确运行
- vb中callbyname函数
- MDI窗体与子窗体显示的问题!!!高分回报!!!参与讨论的都有分哦。。。在线等待。。。
- 再问用vb打开powerpoint文档。难道大家只会word和excel吗?
- ADODC控件怎么打开与数据库的连接?
- 请详细说一说一进一出式语音卡是怎么回事可以吗?谢谢!
- 请教UTF-8和Unicode之间如何转换?
- 怎么使用ADO或SQL删除数据库中的一个表
- 为什么我的数据库在vb6中出现错误。
- 如何用winsock完整的接收不定长的数据包????
- 关于自动生成文档技术。文档自动化求助
- vb中的问题真让人头大
Private Sub grdMingxi_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
SUBMSHFgrid_Sort grdMingxi, x, yEnd Sub
Public Sub SUBMSHFgrid_Sort(FLGrid As MSHFlexGrid, x As Single, y As Single)
Dim dblRowHeight As Double
Dim dblColWidth As Double
Dim i As Integer
Dim AA As Integer
dblColWidth = 0
With FLGrid
If .TextMatrix(1, 1) = "" Then Exit Sub dblRowHeight = .CellHeight If y <= dblRowHeight Then .Row = 0 For i = 0 To .Cols - 1 .Col = i
dblColWidth = dblColWidth + .CellWidth If dblColWidth > x Then
If Val(.Tag) = 1 Then
.Sort = flexSortGenericAscending 此处有错误,当点击其它列没有错,唯有单价这列有错误
.Tag = 2
Else
.Sort = flexSortGenericDescending 此处有错误,当点击其它列没有错,唯有单价这列有错误 .Tag = 1 End If
For j = 1 To .Rows - 1
.TextMatrix(j, 1) = j
Next j
Exit Sub
End If Next i .SelectionMode = flexSelectionByRow
.FocusRect = flexFocusLight
.Row = 1
End If End With
End Sub