# No items shown in the ComboBox

**URL:** <https://forum.kirupa.com/t/no-items-shown-in-the-combobox/264500>\
**Category:** programming\
**Created:** [June 26, 2008, 5:37pm UTC](https://forum.kirupa.com/t/no-items-shown-in-the-combobox/264500 "2008-06-26T17:37:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lllrrr123](https://avatars.discourse-cdn.com/v4/letter/l/c4cdca/32.png) [@lllrrr123](https://forum.kirupa.com/u/lllrrr123)\
**Post date:** [June 26, 2008, 5:37pm UTC](https://forum.kirupa.com/t/no-items-shown-in-the-combobox/264500/1 "2008-06-26T17:37:32Z")

</div>

[SIZE=2][COLOR=#0000ff]Hi, [/COLOR][/SIZE]

[SIZE=2][COLOR=#0000ff]I am a newer in C#. I created a ComboBox, but it didn’t show any items. After clicking, the only item is ‘none’. Can anybody help me with this. Thank you![/COLOR][/SIZE]

[COLOR=#0000ff]Here is part of the code:[/COLOR]

[COLOR=#0000ff][SIZE=2][COLOR=#0000ff]class[/COLOR][/SIZE][SIZE=2][COLOR=#008080]TestReport[/COLOR][/SIZE][SIZE=2][COLOR=#000000] : [/COLOR][/SIZE][SIZE=2][COLOR=#008080]Report[/COLOR][/SIZE]  
[SIZE=2]{[/SIZE]

[SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][SIZE=2] [COLOR=#008080]ComboBox[/COLOR][/SIZE][SIZE=2]tcombo = [/SIZE][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][SIZE=2][COLOR=#008080]ComboBox[/COLOR][/SIZE]SIZE=2;[/SIZE]  
[SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][SIZE=2][] comboNames = { [/SIZE][SIZE=2][COLOR=#800000]“A1”[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#800000]“A2”[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#800000]“A3”[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#800000]“A4”[/COLOR][/SIZE][SIZE=2] };[/SIZE]  
[SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][SIZE=2][COLOR=#008080]List[/COLOR][/SIZE][SIZE=2]\<[/SIZE][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][SIZE=2]\> comboNames2 = [/SIZE][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][SIZE=2][COLOR=#008080]List[/COLOR][/SIZE][SIZE=2]\<[/SIZE][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][SIZE=2]\>();[/SIZE]  
[SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][SIZE=2] secretString2 = [/SIZE][SIZE=2][COLOR=#800000]“A1”[/COLOR][/SIZE][SIZE=2];[/SIZE]

[SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][SIZE=2][COLOR=#000000] TestReport()[/COLOR][/SIZE]  
[SIZE=2]{[/SIZE]  
[SIZE=2][SIZE=2]tcombo.DataSource = comboNames;[/SIZE]

[/SIZE][SIZE=2][SIZE=2]}[/SIZE]  
[SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][SIZE=2][COLOR=#008080]ComboBox[/COLOR][/SIZE][SIZE=2] Test[/SIZE]  
[SIZE=2]{[/SIZE]  
[SIZE=2][COLOR=#0000ff]get[/COLOR][/SIZE]  
[SIZE=2]{[/SIZE]  
[SIZE=2]tcombo.DropDownStyle = [/SIZE][SIZE=2][COLOR=#008080]ComboBoxStyle[/COLOR][/SIZE][SIZE=2].DropDownList;[/SIZE]  
[SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][SIZE=2] tcombo;[/SIZE]  
[SIZE=2]}[/SIZE]  
[SIZE=2][COLOR=#0000ff]set[/COLOR][/SIZE]  
[SIZE=2]{[/SIZE]  
[SIZE=2]tcombo = [/SIZE][SIZE=2][COLOR=#0000ff]value[/COLOR][/SIZE][SIZE=2];[/SIZE]  
[SIZE=2]tcombo.DropDownStyle = [/SIZE][SIZE=2][COLOR=#008080]ComboBoxStyle[/COLOR][/SIZE][SIZE=2].DropDownList;[/SIZE]  
[SIZE=2]} [/SIZE]  
[SIZE=2]}[/SIZE]  
[/SIZE][/COLOR]
