Expand Minimize

Initializer expected

You have tried to declare an instance of a class by using an object initializer in which the initialization list is empty, as shown in the following example.

' Not valid.

' Dim aStudent As New Student With {}

At least one field or property must be initialized in the initializer list, as shown in the following example.

Dim aStudent As New Student With {.year = "Senior"}

Error ID: BC30996

To correct this error

  • Initialize at least one field or property in the initializer, or do not use an object initializer.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft