VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,714 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hallo,
I have a following object and i want to add a string to a list but i am getting error. What am i doing wrong?
Public Class ItemsColl
Public Property Coll1 as List(of String)
End Class
Public CollList as New ItemsColl
CollList.Coll1.Add("StringValue")
Above code gives me 'Object reference not set to an instance of an object.' error.
Try adding 'New':
Public Class ItemsColl
Public Property Coll1 as New List(of String)
End Class
Thanks Viorel Adding New worked.