Cannot convert 'type1' to 'type2'

Cannot convert 'type1' to 'type2'. You can use the 'Value' property to get the string value of the first element of 'parentElement'.

An attempt has been made to implicitly cast an XML literal to a specific type. The XML literal cannot be implicitly cast to the specified type.

Error ID: BC31193

To correct this error

  • Use the Value property of the XML literal to reference its value as a String. Use the CType function, another type conversion function, or the Convert class to cast the value as the specified type.

See Also

Reference

Convert

Type Conversion Functions

Other Resources

Accessing XML in Visual Basic

XML Literals

XML in Visual Basic