The Application I developed is not working properly when I move the app to another windows machine.
I have the Serial Port Enabled in the app and serialPort.open()
is failing.
Also The hardware in fine in both setups as I have tested with teraterm the same config used in APP.
The .Net Framework targeted is same in both machines.
serialPort.BaudRate = 9600;
serialPort.DataBits = 8;
serialPort.Parity = System.IO.Ports.Parity.None;
serialPort.PortName = port_list_comboBox.SelectedItem.ToString();
try
{
serialPort.Open();
return true;
}
catch
{
MessageBox.Show(String.Format("Port Error : {0}",serialPort.PortName));
return false;
}
CodePudding user response:
Currently, your exception handling logic is hiding all meaningful information from the user.
You can use the catch(Exception e)
followed by MessageBox.Show(e.Message);
to better understand what caused the error.