FP Spread 500 lines

Posted by: cmdolcet69 on 8 September 2017, 12:53 pm EST

  • Posted 8 September 2017, 12:53 pm EST

    When i implemented the FP Spread control it seems as if the deault lines is 500.

    For intloop = 0 To gridattributes.ActiveSheet.RowCount - 1
                AddData(gridattributes, charListItemCol, charConditionCol, charstatesCol, intloop)
            Next

    my for loop will add a line each time till the rowcount is met. How can i determine my row count to the last entry on the grid?
    example: if i have 2 entries then my rowcount should be 2 if i have more then its whatever the last number of filled rows.
  • Replied 8 September 2017, 12:53 pm EST

    You can set the row count (fpspread1.sheets(0).rowcount = 2).  There is a GetLastNonEmptyRow method.
  • Replied 8 September 2017, 12:53 pm EST

    Gina can you give me an example of how to call the getLastNonEmptyRow method?
  • Replied 8 September 2017, 12:53 pm EST

    For example:

     TextBox1.Text = FpSpread1.ActiveSheet.GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data)
  • Replied 8 September 2017, 12:53 pm EST

    Sorry Gina im a little confused as to the example that was given. Here's some code from my end that may help.

    Dim intloop As Integer
            For intloop = 0 To gridattributes.ActiveSheet.RowCount - 1
                AddData(gridattributes, charListItemCol, charConditionCol, charstatesCol, intloop)
            Next


    this code will loop though and add the data from each column, what is going on is that the gridattribute.activesheet.rowcount-1 = 500 row and i only want rows that i have actaully put in data.

    In some cases i may only enter 1 row of data and other cases i may enter 3 or 4 rowes of data, in any event how can i control this so my loop doesn't loop every 500 times.
  • Replied 8 September 2017, 12:53 pm EST

    Just change the second part of your loop so it isn't using the RowCount...

    Dim rowsWithData As Integer = FpSpread1.ActiveSheet.GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data)

    Dim intloop As Integer

    For intloop = 0 To rowsWithData
    AddData(gridattributes, charListItemCol, charConditionCol, charstatesCol, intloop)
    Next
Need extra support?

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

Learn More

Forum Channels