vina big

vina big

  • 2.1k
  • 14
  • 1.6k

System.InvalidCastException: 'Specified cast is not valid.'

Sep 6 2017 3:12 PM
run time exception on line this
 
ManagementObjectSearcher searcher1 = new ManagementObjectSearcher("SELECT * FROM Win32_LogicalDiskToPartition");
foreach (ManagementObject dm in searcher1.Get())   //exception at this point
{
diskArray = null;
driveLetter = getValueInQuotes(dm["Dependent"].ToString());
diskArray = getValueInQuotes(dm["Antecedent"].ToString()).Split(',');
 

Answers (2)