Drop Down List Issue
-
I have part of my app which enumerates all video camera devices present and presents them in a drop down list. I have two Logitech web cams which have the same name, but when I click on the drop down button, only one of the cameras are listed. How do I make it so that both are displayed? If possible, how can I add a number or ideally a port number to differentiate the two instances of the web cams? This is my code: <pre> public MainForm() { InitializeComponent(); // collect cameras list try { // enumerate video devices videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); if (videoDevices.Count == 0) throw new ApplicationException(); // add all devices to combo foreach (FilterInfo device in videoDevices) { camerasComboLeft.Items.Add(device.Name); camerasComboRight.Items.Add(device.Name); } camerasComboLeft.SelectedIndex = 0; &nb
-
I have part of my app which enumerates all video camera devices present and presents them in a drop down list. I have two Logitech web cams which have the same name, but when I click on the drop down button, only one of the cameras are listed. How do I make it so that both are displayed? If possible, how can I add a number or ideally a port number to differentiate the two instances of the web cams? This is my code: <pre> public MainForm() { InitializeComponent(); // collect cameras list try { // enumerate video devices videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); if (videoDevices.Count == 0) throw new ApplicationException(); // add all devices to combo foreach (FilterInfo device in videoDevices) { camerasComboLeft.Items.Add(device.Name); camerasComboRight.Items.Add(device.Name); } camerasComboLeft.SelectedIndex = 0; &nb
I guess you need to check if the name is already in the list, and if so, append a number to the name. In that instance, I am assuming you need to add the FilterInfo to the combo box, and set the DisplayMember to be the Name property, otherwise, how do you tell which is which, if not by name ?
Christian Graus Driven to the arms of OSX by Vista. Please read this[^] if you don't like the answer I gave to your question.