/// <summary> /// Initializes ComboBox. /// </summary> private void InitializeComboBox() { // The number of input devices available. int deviceCount = InputDevice.DeviceCount; // The capabilities of an input device. MidiInCaps caps; // For converting ASCII byte text to a string. ASCIIEncoding encoder = new ASCIIEncoding(); try { // Add input device names to the combo box. for (int i = 0; i < deviceCount; i++) { caps = InputDevice.GetCapabilities(i); cboInDevices.Items.Add(encoder.GetString(caps.name)); } } catch (InputDeviceException ex) { MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
/// <summary> /// Initializes ComboBox. /// </summary> private void InitializeComboBox() { // The number of input devices available. int deviceCount = InputDevice.DeviceCount; // The capabilities of an input device. MidiInCaps caps; // For converting ASCII byte text to a string. ASCIIEncoding encoder = new ASCIIEncoding(); // Add input device names to the combo box. for (int i = 0; i < deviceCount; i++) { caps = InputDevice.GetCapabilities(i); cboInDevices.Items.Add(encoder.GetString(caps.name)); } }