get the text value of a column in a selected/highlighted row

Posted by: geneatsb on 8 September 2017, 1:01 pm EST

  • Posted 8 September 2017, 1:01 pm EST

    Hi all,


     


    Just trying to figure out how to get the text from a particular column in a selected row using C#. Thanks.


     


    Gene

  • Replied 8 September 2017, 1:01 pm EST

    Thanks for the help,


     


    The problem I'm having now is capturing the text of the second  column cell in the highlighted row. When I do this:  


    this.fpSpread1_Sheet1.GetSelections().GetValue(0).ToString();


     


    the value that is returned is



    FarPoint.Win.Spread.Model.CellRange


    and not the field value.

     

  • Replied 8 September 2017, 1:01 pm EST

    Gene -

    Just use the GetSelections method which will return a CellRange and get the value from the column you want.
  • Replied 8 September 2017, 1:01 pm EST

    You can figure out the cells with this and then get the value or text for the cell:





     FarPoint.Win.Spread.Model.CellRange cr; 
        cr = fpSpread1.ActiveSheet.GetSelection(1); 
        label1.Text = "The selection covers cells " + cr.Row + ", " + cr.Column + ", " + cr.RowCount + ", " + cr.ColumnCount; 


  • Replied 8 September 2017, 1:01 pm EST

    thanks for your help, but I still can't seem to get it right. Just to reiterate what I need to do: I have two rows on the screen, with 7 columns. What I need to get is the text value of the second column in the selected row.
  • Replied 8 September 2017, 1:01 pm EST

    Use cr.row for the row and the actual column index for the column (fpspread1.sheets(0).cells(cr.row,1).value, etc...
  • Replied 8 September 2017, 1:01 pm EST

    ok, with that last post I finally got it, thanks so much for all your help.


     


    Gene

Need extra support?

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

Learn More

Forum Channels