G
Gailard03
Guest
private void button2_Click(object sender, EventArgs e)
{
ManagementObjectCollection collection;
using (var finddevice = new ManagementObjectSearcher(@"Select A Device"))
collection = finddevice.Get();
foreach (var device in collection)
{
checkedListBox1.Items.Add(device.GetPropertyValue("DeviceID"));
checkedListBox1.Items.Add(device.GetPropertyValue("Description"));
}
}
////// Please help me the "in" within (var device in collection) shows error ( System.Management.ManagementException: "Invalid Query")
Continue reading...
{
ManagementObjectCollection collection;
using (var finddevice = new ManagementObjectSearcher(@"Select A Device"))
collection = finddevice.Get();
foreach (var device in collection)
{
checkedListBox1.Items.Add(device.GetPropertyValue("DeviceID"));
checkedListBox1.Items.Add(device.GetPropertyValue("Description"));
}
}
////// Please help me the "in" within (var device in collection) shows error ( System.Management.ManagementException: "Invalid Query")
Continue reading...