Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WHY the sort dont work in msflexgrid

sal21

Programmer
Apr 26, 2004
479
IT
my code,

CN = Me.LNR.Caption is refred from a label in red is the number of filled rows.

On second clik on GIORNO have a blank rows!

Note:
i have a hide column 10 where numeric value, filled with:

.TextMatrix(R, 10) = Format(STRDBROW(1, K), "yyyymmddhhnnss")

is the formatted dta GIORNO

Private Sub MSFlexGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)

'1-flexSortGenericAscending
'2-flexSortGenericDescending
'3-flexSortNumericAscending
'4-flexSortNumericDescending
'5-flexSortStringNoCaseAsending
'6-flexSortNoCaseDescending
'7-flexSortStringAscending
'8-flexSortStringDescending

Dim CL As Integer, RW As Integer, CN As Long

With Me.MSFlexGrid1

RW = .MouseRow

If Me.LNR.Caption >= 1 Then

CN = Me.LNR.Caption

If .MouseCol = 1 And Button = vbLeftButton And RW = 0 Then

.Redraw = False

.RowSel = CN
.Col = 10

If strSort = 1 Then
.Sort = 3
strSort = 2
Else
.Sort = 4
strSort = 1
End If

.TopRow = 1

.Redraw = True

End If

End If

End With

Me.Text1.SetFocus

End Sub
 

Attachments

  • default.jpg
    default.jpg
    115.4 KB · Views: 7
  • clicked.jpg
    clicked.jpg
    151.4 KB · Views: 8
Flexgrids sort on an entire column - you can't only sort part of that column. And whilst you have populated only 15 rows, there are MORE than 15 rows in your columns. And so empty values are being included in your sort.
 

Part and Inventory Search

Sponsor

Back
Top