Sub InitializeForm() Dim bitRates(9) As Integer Dim nameArray() As String ' Find the COM ports on the system. nameArray = SerialPort.GetPortNames Array.Sort(nameArray) ' Fill a combo box with the port names. cmbPorts.DataSource = nameArray cmbPorts.DropDownStyle = _ ComboBoxStyle.DropDownList ' Select a default port. cmbPorts.SelectedIndex = 1 'Bit rates to select from. 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 'Place the bit rates in a combo box. cmbBitRate.DataSource = bitRates cmbBitRate.DropDownStyle = _ ComboBoxStyle.DropDownList ' Select a default bit rate. cmbBitRate.SelectedItem = 1200 End Sub Listing 1. Combo boxes on the form enable users to select a port and bit rate.