. . . .
{
String str1 = comboBox1.Text;//串口号
String str2 = comboBox2.Text;//波特率
String str3 = comboBox3.Text;//校验位
String str4 = comboBox5.Text;//停止位
.下载可编辑.
String str5 = comboBox4.Text;//数据位
Int32 int2 = Convert.ToInt32(str2);//将字符串转为整型
Int32 int5 = Convert.ToInt32(str5);//将字符串转为整型
groupBox3.Enabled = true;//LED控制界面变可选
try
{
if (button1.Text == "打开串口")
{
if (str1 == null)
{
MessageBox.Show("请先选择串口!", "Error");
return;
}
sp.Close();