private void connectController() { ControllerInfoCollection controllers = scanner.Controllers; foreach (ControllerInfo info in controllers) { if (comboBox1.Text.Equals(info.ControllerName + " / " + info.IPAddress.ToString())) { if (info.Availability == Availability.Available) { if (myRobot != null) { myRobot.Dispose(); // = LogOff myRobot = null; } myRobot = new RobotClass(ControllerFactory.CreateFrom(info)); myRobot.StartRapidProgram(); break; } } { MessageBox.Show("Selected controller not available."); } } if (myRobot == null) { MessageBox.Show("Selected controller not available. (comboBox String != controller info)"); } }