1
Support Questions / Re: Edit driver between child forms
« on: September 30, 2018, 06:52:23 AM »
Tank you for all the suggestions. Never got this too work with this solution. I think it is a permission issue between two different child forms from the same parent.
My solution is to just call the setup form from the form where the driver is located. In this way the form with the driver is the parent form for the setup form.
Button.click() on the form where the driver is located
' Ã…pne en dialogboks med innstillingene
If oppsettForm.ShowDialog <> DialogResult.OK Then
MessageBox.Show("Ingenting ble lagert!", "Innstillinger", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
MessageBox.Show("De nye innstillingene ble lagert!", "Innstillinger", MessageBoxButtons.OK, MessageBoxIcon.Information)
' Endre hva Parity vises som
Dim Parity As String = 0
Select Case oppsettForm.cbParity.Text
Case "None"
Parity = 0
Case "Odd"
Parity = 1
Case "Even"
Parity = 2
Case "Mark"
Parity = 3
Case "Space"
Parity = 4
End Select
' Endre hva StopBits vises som
Dim StopBits As String = 0
Select Case oppsettForm.cbStopBits.Text
Case "None"
StopBits = 0
Case "One"
StopBits = 1
Case "Two"
StopBits = 2
Case "OnePointFife"
StopBits = 3
End Select
Me.ModbusRTUCom1.BaudRate = oppsettForm.tbBaud.Text
Me.ModbusRTUCom1.PortName = oppsettForm.cbComport.Text
Me.ModbusRTUCom1.DataBits = oppsettForm.tbDataBits.Text
Me.ModbusRTUCom1.Parity = Parity
Me.ModbusRTUCom1.PollRateOverride = oppsettForm.tbPollrate.Text
Me.ModbusRTUCom1.StationAddress = oppsettForm.tbAddresse.Text
Me.ModbusRTUCom1.StopBits = StopBits
End If
My solution is to just call the setup form from the form where the driver is located. In this way the form with the driver is the parent form for the setup form.
Button.click() on the form where the driver is located
' Ã…pne en dialogboks med innstillingene
If oppsettForm.ShowDialog <> DialogResult.OK Then
MessageBox.Show("Ingenting ble lagert!", "Innstillinger", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
MessageBox.Show("De nye innstillingene ble lagert!", "Innstillinger", MessageBoxButtons.OK, MessageBoxIcon.Information)
' Endre hva Parity vises som
Dim Parity As String = 0
Select Case oppsettForm.cbParity.Text
Case "None"
Parity = 0
Case "Odd"
Parity = 1
Case "Even"
Parity = 2
Case "Mark"
Parity = 3
Case "Space"
Parity = 4
End Select
' Endre hva StopBits vises som
Dim StopBits As String = 0
Select Case oppsettForm.cbStopBits.Text
Case "None"
StopBits = 0
Case "One"
StopBits = 1
Case "Two"
StopBits = 2
Case "OnePointFife"
StopBits = 3
End Select
Me.ModbusRTUCom1.BaudRate = oppsettForm.tbBaud.Text
Me.ModbusRTUCom1.PortName = oppsettForm.cbComport.Text
Me.ModbusRTUCom1.DataBits = oppsettForm.tbDataBits.Text
Me.ModbusRTUCom1.Parity = Parity
Me.ModbusRTUCom1.PollRateOverride = oppsettForm.tbPollrate.Text
Me.ModbusRTUCom1.StationAddress = oppsettForm.tbAddresse.Text
Me.ModbusRTUCom1.StopBits = StopBits
End If