how to sort the columns in a sheet

Posted by: sridhar on 8 September 2017, 1:06 pm EST

  • Posted 8 September 2017, 1:06 pm EST

    hi iam working on a migration project from vb6 to vb.net(vs2005).


    in this i need to sort the columns in a sheet.


    in vb6 theyspread 6.0 and did it using the following code


    spread1.Col = COL1
    spread1Col2 = COL2
    spread1.Row = -1
    s
    pread1.UserColAction = UserColActionSort


    i need to know how to do the same in vb.net using spread 3.0


    please help me


     

  • Replied 8 September 2017, 1:06 pm EST

    The Spread 3 OCX does not have usercolactionsort (or are you asking about Spread Win 3 .net)?  You would need to call the Sort action when the user clicks on the header.
  • Replied 8 September 2017, 1:06 pm EST

    iam using Farpoint Spread 6.0 in vb6


    and in vb.net iam using Farpoint Spread 3.0


     

  • Replied 8 September 2017, 1:06 pm EST

    You said you are using Farpoint Spread 3.0.  Do you mean the OCX or the .Net control?  I'm guessing you mean the .net control since 3.0 OCX is older than the 6.0 OCX.  We have a different forum for Spread for Windows Forms .net questions.

    Dim col As
    FarPoint.Win.Spread.Column
    col =
    FpSpread1.ActiveSheet.Columns(0)
    FpSpread1.ActiveSheet.Cells(0, 0).Text =
    "Alignment"
    FpSpread1.ActiveSheet.Cells(1, 0).Text
    = "CarbAdjust"
    FpSpread1.ActiveSheet.Cells(2,
    0).Text = "Brakes"
    col.SortIndicator =
    FarPoint.Win.Spread.Model.SortIndicator.Descending
    col.ShowSortIndicator =
    True
    col.AllowAutoSort = True

  • Replied 8 September 2017, 1:06 pm EST

     


    is the above code works only for sorting in descending order or works for sorting in both ways


     

  • Replied 8 September 2017, 1:06 pm EST

    This should work for sorting in either direction.
  • Replied 8 September 2017, 1:06 pm EST

    yes its working now
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels