相关疑难解决方法(0)

Sub New() 在此上下文中无法访问,因为它是“Friend”

那么这是什么意思以及如何解决它?

如果我将 New 关键字放在下面的行中,则会出现此消息。如果删除它,我会在运行时收到错误消息,提示我需要使用 New。我究竟做错了什么?

Dim oPS As AeccPointStyle = New AeccPointStyle
ops = oDescKey.PointStyle 

Debug.Print(oPS.Name)
Debug.Print(oPS.MarkerSymbolName)
Run Code Online (Sandbox Code Playgroud)

也尝试过

Dim oPS As New AeccPointStyle
ops = oDescKey.PointStyle

Debug.Print(oPS.Name)
Debug.Print(oPS.MarkerSymbolName)
Run Code Online (Sandbox Code Playgroud)

谢谢!

更新 1 - 基于 Meta-Knight 的评论

1 -

Dim oPS As AeccPointStyle = Nothing
oPS = oDescKey.PointStyle
Run Code Online (Sandbox Code Playgroud)

2 -

Dim oPS As AeccPointStyle = oDescKey.PointStyle
Run Code Online (Sandbox Code Playgroud)

两个版本都会抛出 NullReferenceExceptions。

vb.net

5
推荐指数
1
解决办法
4万
查看次数

标签 统计

vb.net ×1