private void FrmMain_Load(object sender, EventArgs e) { var ports = SerialPort.GetPortNames(); cmbPorts.DataSource = ports; if (cmbPorts.Items.Count == 0) { btnOpen.Enabled = false; } _reader = new BarCodeReader(); }