有人可以帮我解决这个问题..吗?尝试调试代码时出现此错误..
private void Form2_Load(object sender, System.EventArgs e)
{
this.Show();
Form1.DefaultInstance.Close();
ToolTip1.SetToolTip(ComboBox1, "Please enter a VALID phone number");
ToolTip1.SetToolTip(ComboBox2, "Please check your COM port number before selecting. Connection could be made for outgoing cable or bluetooth port with data calling supported phone.");
ComboBox1.SelectedIndex = 0;
for (int i = 0; i < My.Computer.Ports.SerialPortNames.Count; i++)
{
ComboBox2.Items.Add(My.Computer.Ports.SerialPortNames(i));
}
ComboBox2.SelectedIndex = 0;
}
这发生在这一行的“ SerialPortNames ”:
ComboBox2.Items.Add(My.Computer.Ports.SerialPortNames(i));