For my application, the user can select their preferred WiFi Access point they want to connect to using a Combobox. I'm trying to convert the selected item from the Combobox to a string value to be used with the SimpleWifi library
This is my attempted solution:
ComboBox selectedItem = (ComboBox)cbWifiname.SelectedItem;
AccessPoint ap = (AccessPoint)selectedItem.Tag;
An example code solution that I'm trying to follow
ListViewItem selecteditem = listView2.SelectedItems[0];
AccessPoint ap = (AccessPoint)selecteditem.Tag;
But the result of my attempted solution of using a combobox, a debugging error showing "Unable to cast object of type 'System.String to type 'System.Windows.Forms.Combobox''
ComboBox selectedItem = (ComboBox)cbWifiname.SelectedItem
. what is the type of item you add there, is it a class or a string? – Ashkan Mobayen Khiabani