Late bound resolution; runtime errors could occur

An object is assigned to a variable declared to be of the Object Data Type.

When you declare a variable as Object, the compiler must perform late binding, which causes extra operations at run time. It also exposes your application to potential run-time errors. For example, if you assign a Form to the Object variable and then try to access the XmlDocument.NameTable property, the runtime throws a MemberAccessException because the Form class does not expose a NameTable property.

If you declare the variable to be of a specific type, the compiler can perform early binding at compile time. This results in improved performance, controlled access to the members of the specific type, and better readability of your code.

By default, this message is a warning. For information on hiding warnings or treating warnings as errors, see Configuring Warnings in Visual Basic.

Error ID: BC42017

To correct this error

  • If possible, declare the variable to be of a specific type.

See Also

Early and Late Binding
Object Variable Declaration