i have this exmaple code coded on this forum , and it work very well for flexgrid. but when i start to used it on MSHFLEXGRID it become malfunction. What is the problem on this code. when i click on the header, everthing started to sort. it turn out very messy. When i set the properties header, i was thrown with error for the "out of range" msg. Sorry for the lengthly code.
VB Code:
Private Sub Form_Load()
With presentation_search.presentationCollection_grid
.TextMatrix(0, 1) = "Presentation ID"
.TextMatrix(0, 2) = "Presentation Name"
.TextMatrix(0, 3) = "Presentation Type"
end with
end sub
Private Sub presentationCollection_grid_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
' If this is not row 0, do nothing.
If presentationCollection_grid.MouseRow <> 0 Then
Exit Sub
End If
' Sort by the clicked column.
SortByColumn presentationCollection_grid.MouseCol
End Sub
' Sort by the indicated column.
Private Sub SortByColumn(ByVal sort_column As Integer)
presentationCollection_grid.Visible = False
presentationCollection_grid.Refresh
' Sort using the clicked column.
presentationCollection_grid.Col = sort_column
presentationCollection_grid.ColSel = sort_column
presentationCollection_grid.Row = 0
presentationCollection_grid.RowSel = 0
' If this is a new sort column, sort ascending.
' Otherwise switch which sort order we use.
If m_SortColumn <> sort_column Then
m_SortOrder = flexSortGenericAscending
ElseIf m_SortOrder = flexSortGenericAscending Then
i only check the ColumnHeader at the properties checkbox. when i click on the row index 0, the grid began to sort but in a messy manner. it amy not be in the same row. it seem that i need to set the header or to do a fix row. but how to set the header? or how should i edit the code to make it function:?
Use the code above, but change the gridname MSHFlexGrid1 to your Flexgrids name. If you only want to sort on one column, you will have to set the mousecol in the click event, instead of allowing any column to be sorted.
Also, you have to declare the M_ variables. You can use Integer type.
Use the code above, but change the gridname MSHFlexGrid1 to your Flexgrids name. If you only want to sort on one column, you will have to set the mousecol in the click event, instead of allowing any column to be sorted.
Also, you have to declare the M_ variables. You can use Integer type.
hihi,
how can i fix a row?when i click on the header, it does not do anything.
i set my header like this-->
VB Code:
With MSHFlexGrid1.
.TextMatrix(0, 1) = "Artifact 1"
.TextMatrix(0, 2) = "Artifact 2"
.TextMatrix(0, 3) = "Artifact 3"
.TextMatrix(0, 4) = "Artifact 4"
.TextMatrix(0, 5) = "Artifact 5"
.TextMatrix(0, 6) = "Artifact 6"
End With
am i on the right track? i did not set anyproperties to the gird. i use the defult setting of MSHFLEXGRID.