Using SingleSelect

Posted by: mdbenoit on 28 November 2024, 4:32 pm EST

    • Post Options:
    • Link

    Posted 28 November 2024, 4:32 pm EST

    Upon loading a WinForm, I document a Spread.net instance with multiple rows of data and set it to SingleSelect mode. In Spread.com, the SelModeSelected property gets/sets the selected row and I would like to understand what is the equivalent in Spread.net. Therefore:

    Question 1: How can I set the instance to have the first row selected before form activation.

    Question 2: How can I know what row is selected afterwards by a user.

  • Posted 29 November 2024, 5:26 am EST

    We have created a sample application with the latest version of Spread control, i.e. V17, that shows how to achieve the desired behavior:

    1. You can use SheetView’s AddSelection() method to select the first row of the sheet.
    spread.Sheets[0].AddSelection(0, 0, 1, spread.Sheets[0].ColumnCount);
    1. You can fetch the selected row by using SheetView’s GetSelection() method as shown below:
    int selectedRow = spread.Sheets[0].GetSelection(0).Row;

    Kindly refer to the attached sample for full implementation. See

    SpSingleSelect.zip

    Thanks & Regards,

    Aastha

  • Posted 29 November 2024, 11:57 am EST

    Thank you for your response Aastha.

    However, I may not have provided a clear description of my issue w.r.t. my first question. Let’s say that we have a fully documented instance of Spread which already contains multiple rows. How can I then set a row as the selected row? For reference, with Spread.com, it would be

    Spread1.Row = 8
    Spread1.SelModeSelected = True
    .

    By the way, I am using VB.net.

    Thanks!

  • Posted 2 December 2024, 6:48 am EST

    Hi Michel,

    We are not exactly sure what you meant by a “fully documented instance.” However, based on our understanding, we have created a simple example of an FpSpread instance containing data. Below is a code snippet demonstrating how to select a row in this instance:

    spread.Sheets(0).ClearSelection()
    spread.Sheets(0).ActiveRowIndex = 7
    spread.Sheets(0).AddSelection(7, 0, 1, spread.Sheets(0).ColumnCount)

    You can refer to the attached sample for implementation: SingleSelectSpread.zip

    If our understanding differs with your requirement, we kindly request you to provide a simplified version of your application along with a detailed explanation of your use-case to help us better understand and assist you.

    Thanks & Regards,

    Aastha

Need extra support?

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

Learn More

Forum Channels