hi,
in the top you define string baudRate="";, then you are again using this string in
_serialPort.BaudRate =Convert.ToInt32(baudRate.ToString());
defaultPortBaudRate = Convert.ToInt32(baudRate.ToString());
Can you directly set 0 to the Baud Rate ?
int baudRate = 0;
if not then you can use :-
int.TryParse(baudRate.ToString(),out baudRate)