Author Topic: Change parity in Combobox not working?  (Read 1927 times)

Yoni

  • Newbie
  • *
  • Posts: 2
    • View Profile
Change parity in Combobox not working?
« on: July 20, 2021, 06:18:58 PM »
Hi all,

I'm new here.
I'm trying a couple off days to create a project, to read Modbus values from a Air Handling Group.
I want to make it possible to change connection settings in de HMI.

It's working well, only one thing is not working: Parity.
When i change parity in a combobox, i get a error.

This is the code for the combo:

Code: [Select]
    Private Sub ComboBox3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox3.SelectedIndexChanged
        ModbusRTUCom1.Parity = ComboBox3.SelectedItem
    End Sub

Yoni

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Change parity in Combobox not working?
« Reply #1 on: July 21, 2021, 12:27:03 PM »
Update:
I found the problem...
The value must be a number...

But now a new question:
How can i keep my combobox with TEXT for the Parity and Stopbit but convert it to numbers for the combobox to work?

For example:
None = 0
Odd = 1
Even = 2


Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Change parity in Combobox not working?
« Reply #2 on: August 14, 2021, 03:08:06 AM »
Check the code of one of these applications:

   https://www.advancedhmi.com/forum/index.php?topic=2567.0