[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]