Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'myPort = IO.Ports.SerialPort.GetPortNames() 'Get all com ports available
Me.ComboBox2.Items.AddRange({"(MBZ)Modbus over ZCP", "(RUP)Room Unit protocol", "(MSP)Master Slave protocol", "(NDP)Node discovery protocol"})
ComboBox3.Enabled = False
End Sub
Private Sub ComboBox2_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
Dim strWords As String() = {"(MBZ) Read coils(0x01)", "(MBZ) Read discrete inputs(0x02)", "MBZ Read holding registers(0x03)", "MBZ Read input registers(0x04)", "MBZ Write single coil(0x05)", "MBZ Write single register(0x06)", "MBZ Write multiple coils(0x0F)", "MBZ Write multiple registers(0x10)", "RUP Mating request(0x00)", "RUP Mating reply(0x01)", "RUP Temperature(0x02)", "RUP Button press(0x03)", "RUP Button press ACK(0x04)", "MSP Mating announcement(0x00)", "MSP Slave data(0x01)", "MSP Heating output(0x02)", "NDP Ping(0x00)", "NDP Pong(0x01)"}
Dim NewComboList As IEnumerable(Of String) = (From Words In strWords Where Words.Contains(ComboBox2.SelectedItem.ToString.Substring(1, 3)) Select Words)
With ComboBox3
.SelectedIndex = -1
.Items.Clear()
End With
For Each Word In NewComboList
ComboBox3.Items.Add(Word)
Next
ComboBox3.Enabled = True
End Sub