There is such a condition:
if (queryObj["DeviceID"].ToString().Trim() == @"USB\VID_0403&PID_6001\A900ER2T") { // TODO } In queryObj["DeviceID"] is exactly the same text as on the right when comparing. Even brought it to MessageBox for clarity:
When this condition does not work - what's the catch?
Compared to the length of the lines:
1) USB\VID_0403&PID_6001\A900ER2T##30 // где 30 длина строки 2) string str2 = @"USB\VID_0403&PID_6001\A900ER2T"; // 30 Now the check is:
string PID = "0403"; string VID = "6001"; MessageBox.Show(str_PID + " | " + str_VID); if (str_PID == PID && str_VID == VID){ Сюда не заходит при этом str_PID = 0403 str_VID = 6001 } 
string s1 = queryObj["DeviceID"].ToString().Trim(); string s2 = @"USB\VID_0403&PID_6001\A900ER2T"; for (int i = 0; i < 30; i++) if (s1[i] != s2[i]) MessageBox.Show("Position " + i);string s1 = queryObj["DeviceID"].ToString().Trim(); string s2 = @"USB\VID_0403&PID_6001\A900ER2T"; for (int i = 0; i < 30; i++) if (s1[i] != s2[i]) MessageBox.Show("Position " + i);? - VladD