B
Benedictum
I have the following method that initializes the port. I am having problems
assigning values to the Serial port properties. Can someone help ? Here is
the snippet with my comments:
private void btnOpenPort_Click(object sender, EventArgs e)
{
if (ServoPort.IsOpen)
{
ServoPort.Close();
btnOpenPort.Text = "Open Port";
}
else
{
// SerialPort parameters
ServoPort.PortName = tbxSPortName.Text; // This is OK
ServoPort.BaudRate = int.Parse(tbxSBaud.Text); // This is OK
ServoPort.Parity = int.Parse(tbxSParity.Text); // ERROR!
ServoPort.DataBits = int.Parse(tbxSDatabits.Text); // This is OK
ServoPort.StopBits = int.Parse(tbxSStopbit.Text); //ERROR!
btnOpenPort.Text = "Close Port";
}
}
Any other ideas are welcome.
assigning values to the Serial port properties. Can someone help ? Here is
the snippet with my comments:
private void btnOpenPort_Click(object sender, EventArgs e)
{
if (ServoPort.IsOpen)
{
ServoPort.Close();
btnOpenPort.Text = "Open Port";
}
else
{
// SerialPort parameters
ServoPort.PortName = tbxSPortName.Text; // This is OK
ServoPort.BaudRate = int.Parse(tbxSBaud.Text); // This is OK
ServoPort.Parity = int.Parse(tbxSParity.Text); // ERROR!
ServoPort.DataBits = int.Parse(tbxSDatabits.Text); // This is OK
ServoPort.StopBits = int.Parse(tbxSStopbit.Text); //ERROR!
btnOpenPort.Text = "Close Port";
}
}
Any other ideas are welcome.