Syncfusion.XlsIO.Base
Example 


SelectedIndex Property (IComboBoxShape)

Gets or sets selected item index of the combo box.
Syntax
'Declaration
 
Property SelectedIndex As Integer
'Usage
 
Dim instance As IComboBoxShape
Dim value As Integer
 
instance.SelectedIndex = value
 
value = instance.SelectedIndex
int SelectedIndex {get; set;}
Example
The following code illustrates how to set the SelectedIndex property.
using Syncfusion.XlsIO;
            
class Program
{
    static void Main()
    {
        using (ExcelEngine excelEngine = new ExcelEngine())
        {
            //Create worksheet
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Create(1);
            IWorksheet worksheet = workbook.Worksheets[0];
            
            //Load data
            worksheet["J1"].Value = "1";
            worksheet["J2"].Value = "2";
            worksheet["J3"].Value = "3";
            
            //Add combobox
            IComboBoxShape combobox = worksheet.ComboBoxes.AddComboBox(2, 2, 20, 100);
            
            //Add combobox data
            combobox.ListFillRange = worksheet["J1:J3"];
            
            //Set linked cell
            combobox.LinkedCell = worksheet["D2"];
            
            //Set selected index
            combobox.SelectedIndex = 2;
            
            //Save and dispose
            workbook.SaveAs("Shapes.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.2460.0.34

See Also