I added items using Properties and at runtime, the dropdown had no items there.
I am a little confused and would really appreciate any help.
I also didnt see a way for me to assign an Event Handler to the Combobox.
I added items using Properties and at runtime, the dropdown had no items there.
I am a little confused and would really appreciate any help.
I also didnt see a way for me to assign an Event Handler to the Combobox.
use combobox.Items.Add()
to add items to the combo box, then you can set the default selection using combobox.SelectedIndex
more info: https://msdn.microsoft.com/en-us/library/aa983551(v=vs.71).aspx
Example:
foreach (string s in SerialPort.GetPortNames())
{
comboMachinePort.Items.Add(s);
}
comboMachinePort.SelectedIndex = 0;