Dictionary holding a class issue

Not sure if this is possible but the below code doesn’t work.
The Books class has three string properties.

  dim test as new Books
  test.nameBook="My book"
  test.typeBook="Roman"
  test.shortdescriptionBook="blablablabla"
  
  Dim testDictionary as New Dictionary  
  testDictionary.Value("1") = test
  
  Dim bookShop() As Books
  
  bookShop() = testDictionary.Value("1")

This gives :
An exception of class TypeMismatchException was not handled. The application must shut down.

Does this mean a Dictionary cannot hold a class? (Probably a stupid question :slight_smile:

You’re creating an array and then try to assign a single value to it. Try appending it.

Oh boy… off course I have to append it. Bummer.
I have to stop coding today. :slight_smile:

I guess we all know those days … :wink: