private void button4_Click(object sender, EventArgs e) { TSSerialPort p = (TSSerialPort)comboBox.SelectedItem; p.Open(); p.SerialArrived += p_SerialArrived; }
private void Form1_Load(object sender, EventArgs e) { List <TSSerialPort> ss = TSSerialPort.GetPorts(); foreach (TSSerialPort s in ss) { comboBox.Items.Add(s); } if (comboBox.Items.Count != 0) { comboBox.SelectedIndex = 0; } CheckForIllegalCrossThreadCalls = false; }