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

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

See Also

Object Initializers: Named and Anonymous Types
How to: Declare an Object by Using an Object Initializer