locked
How to get selected text in combobox RRS feed

  • Question

  • Hi All.
    The ComboBox is binding to Entity table. And when I tried code:
     string Name = ((Employee)EmpCombobox.SelectedItem).Name.ToString();
    I got error message:
    Cannot convert type 'System.Windows.Controls.ItemCollection' to 'ProjectName.Common.Employee'

    How to fix the problem?

    Thanks.




    • Edited by zleug Tuesday, September 15, 2020 1:18 PM
    • Moved by CoolDadTx Tuesday, September 15, 2020 2:07 PM Winforms related
    Tuesday, September 15, 2020 1:16 PM

All replies

  • This forum is for C#-specific questions only. Please post questions related to Windows Forms in the new Microsoft Q&A forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, September 15, 2020 2:07 PM