title: VB6 - How to do a multi level sort with MSFlexGrid?
body: <p>I currently have a VB6 program that essential reads data from an excel worksheet and spits it out into a MSFlexGrid.</p>
  <p>Below is the excel sheet data that is read in. Data is filled into the occurence column for the <strong>left half</strong> of the table.</p>
  <p><a href="http://www.dipzo.com/initial.PNG" rel="nofollow noreferrer"><a href="https://i.stack.imgur.com/tDJBi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tDJBi.png" width="620"></a><br />
  <sub>(source: <a href="http://www.dipzo.com/initial.PNG" rel="nofollow noreferrer">dipzo.com</a>)</sub>  </a></p>
  <p>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:</p>
  <pre><code>Private Sub GridSort(temp() As String)
  fgData.Rows = UBound(temp)
  x = 0
   Do While x &lt; 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 &lt; 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
  </code></pre>
  <p>Now this works to a degree. It sorts the Data by occurences and outputs as so:</p>
  <p><a href="http://www.dipzo.com/end.PNG" rel="nofollow noreferrer"><a href="https://i.stack.imgur.com/vqiED.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vqiED.png" width="620"></a><br />
  <sub>(source: <a href="http://www.dipzo.com/end.PNG" rel="nofollow noreferrer">dipzo.com</a>)</sub>  </a></p>
  <p>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?</p>