1

I currently have a VB6 program that essential reads data from an excel worksheet and spits it out into a MSFlexGrid.

Below is the excel sheet data that is read in. Data is filled into the occurence column for the left half of the table.


(source: dipzo.com)

The VB6 Application then read this data into a multi dimensional array which is then fed into a MSFlexGrid object. Here is the code to do that:

Private Sub GridSort(temp() As String)
fgData.Rows = UBound(temp)
x = 0
 Do While x < fgData.Rows
    fgData.Row = x
    fgData.Col = 0
    fgData.Text = temp(x, 0)
    fgData.Col = 1
    fgData.Text = temp(x, 1)
    x = x + 1
  Loop
  fgData.ColSel = 1
  fgData.Sort = flexSortGenericDescending
  x = 0
  Do While x < fgData.Rows
    fgData.Row = x
    fgData.Col = 0
    temp(x, 0) = fgData.Text
    fgData.Col = 1
    temp(x, 1) = fgData.Text
    x = x + 1
  Loop

End Sub

Now this works to a degree. It sorts the Data by occurences and outputs as so:


(source: dipzo.com)

However, you can see that it messed up the order of the first column. I want the data to be sorted by occurences first, but for data with the same amount of occurences, I want them sorted by operation. Does anybody know a way to accomplish this?

4

1 回答 1

1

MSFlexGrid 通过从左到右对列进行排序,并且始终以相同的顺序(降序/升序)对多列中的数据进行排序。因此,您可以交换“发生”和“操作”列来实现您的目标。

否则,我在这里找到了一个很好的 MSFlexGrid 函数集合,还有一个用于多列排序的条目。查找条目“对多列进行排序”。没测试过,不过你可以试试。

于 2009-03-24T19:18:01.253 回答