Managing Ports and Transfers in .NET
cmbBitRate.DataSource = bitRates
private int[] bitRates = new int[ 11 ];
bitRates[ 0 ] = 300;
bitRates[ 1 ] = 600;
bitRates[ 2 ] = 1200;
bitRates[ 3 ] = 2400;
bitRates[ 4 ] = 9600;
bitRates[ 5 ] = 14400;
bitRates[ 6 ] = 19200;
bitRates[ 7 ] = 38400;
bitRates[ 8 ] = 57600;
bitRates[ 9 ] = 115200;
bitRates[ 10 ] = 128000;
cmbBitRate.DataSource = bitRates;
The combo box displays the bit rates as text.
To initialize a combo box with flow-control methods, add each item to the
combo box:
cmbHandshaking.Items.Add(Handshake.None)
cmbHandshaking.Items.Add(Handshake.XOnXOff)
cmbHandshaking.Items.Add(Handshake.RequestToSend)
cmbHandshaking.Items.Add(Handshake.RequestToSendXOnXOff)
cmbHandshaking.Items.Add( Handshake.None );
cmbHandshaking.Items.Add( Handshake.XOnXOff );
cmbHandshaking.Items.Add( Handshake.RequestToSend );
cmbHandshaking.Items.Add( Handshake.RequestToSendXOnXOff );
The combo box displays the ToString property of each Handshake object.
In similar ways, you can add combo boxes for setting the number of data bits,
parity, and Stop bits as needed.