Sub New() is not accessible in this context because it is 'Friend'
vb.net
Solution
The empty constructor of AeccPointStyle is marked as friend, which means only classes inside its assembly can call it.
But looking at your code, I don't think you need to call New. Just set it to Nothing at first. Or even better, directly set your variable with the good value:
Dim oPS As AeccPointStyle = oDescKey.PointStyle
Edit about your NullReferenceException:
Typically, this type of exception is raised when you call a property of an object with a value of Nothing. In this case, if oDescKey was set to Nothing, such an exception would be raised.
If oDescKey does NOT have a value of Nothing, then the only thing that executes some code is the PointStyle property. So it's safe to assume that the PointStyle property throws a NullReferenceException. Try watching the oDescKey.PointStyle variable in the debugger, you should see that it throws an exception.
Problem
So what does this mean and how do I fix it? This message occurs if I place the New keyword in the line(s) below. If I remove it, i get an error at runtime saying I need to use New. What am I doing wrong? ``` Dim oPS As AeccPointStyle = New AeccPointStyle ops = oDescKey.PointStyle Debug.Print(oPS.Name) Debug.Print(oPS.MarkerSymbolName) ``` Also tried ``` Dim oPS As New AeccPointStyle ops = oDescKey.PointStyle Debug.Print(oPS.Name) Debug.Print(oPS.MarkerSymbolName) ``` Thanks! Update 1 - based on comment from Meta-Knight 1 - ``` Dim oPS As AeccPointStyle = Nothing oPS = oDescKey.PointStyle ``` 2 - ``` Dim oPS As AeccPointStyle = oDescKey.PointStyle ``` Both versions throw NullReferenceExceptions.