Nemoticchigga 0 Junior Poster in Training
String^     comPort  = "COM" + this->RS232CommPortNum->Value;
int         baudRate = Convert::ToInt32(this->cbBaudRate->Value);
com      = gcnew SerialPort(comPort, baudRate);

try
{
	com->Open();
}
catch (...) 
{
	::MessageBox::Show("Invalid Port");
}

How do I handle this excepion thrown when the com number is not valid? When I run the release version it has an error when an invalid port is opened. I just want to show the message box and move on. Any suggestions? Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.