Syncfusion.XlsIO.Base
Example 


SelectedValue Property (IComboBoxShape)

Gets value selected in combobox.
Syntax
'Declaration
 
ReadOnly Property SelectedValue As String
'Usage
 
Dim instance As IComboBoxShape
Dim value As String
 
value = instance.SelectedValue
string SelectedValue {get;}
Remarks
1-based indexing is used to access the values in combobox list.
Example
The following code illustrates how to access SelectedValue property.
using Syncfusion.XlsIO;
using System;
            
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 selected index
            combobox.SelectedIndex = 1;
            
            //Get selected value
            Console.Write(combobox.SelectedValue);
            
            //Save and dispose
            workbook.SaveAs("Shapes.xlsx");
            workbook.Close();
            Console.ReadKey();
        }
    }
}
//Output will be
//1
AssemblyVersion

Syncfusion.XlsIO.Base: 17.1460.0.47

See Also