Public Class Log
Public Shared Sub Log(p1 as integer, optional p2 as integer)
Try
Catch ex As Exception
End Try
End Sub
End Class
Public Class ShortCutClass
Public Shared Sub Log(p1 as integer)
Try
Log.Log(p1) '~~~~~~
Catch ex As Exception
End Try
End Sub
End Class
Argument not specified for parameter p1 of 'Public Shared Sub Log(p1 as integer)'
I have a Class called Log
, with a Sub Called Log
.
我有一个名为Log的类,带有一个Sub Subled Log。
Sometimes in the website, ShortCutClass.Log
is called - it is existing code and the only place I can make a change is within ShortCutClass.Log
有时在网站上调用ShortCutClass.Log--它是现有代码,我可以进行更改的唯一地方是ShortCutClass.Log
There are many calls to both Log.Log and ShortCutClass.Log
Log.Log和ShortCutClass.Log都有很多调用
I am getting the error "Argument not specified for parameter p1 of 'Public Shared Sub Log(p1 as integer)'"
It is like Log.Log
tries to call itself, and then sees that it expects the parameter
我收到错误“没有为'公共共享子日志(p1作为整数)'的参数p1指定参数”这就像Log.Log尝试调用自身,然后看到它期望参数
How can I call Log.Log
from
我怎样才能从中调用Log.Log
ShortCutClass.Log
1 个解决方案
#1
Before Log.Log(p1)
you could type the namespace of the project.
在Log.Log(p1)之前,您可以键入项目的命名空间。
Like this: Namespace.Log.Log(p1)
(Namespace could be the project name)
像这样:Namespace.Log.Log(p1)(Namespace可能是项目名称)
And the Optional Parameter should have a default value like this:
而Optional参数应该有一个默认值,如下所示:
Public Shared Sub Log(p1 as integer, Optional p2 as integer = 0)
公共共享子日志(p1作为整数,可选p2作为整数= 0)
#1
Before Log.Log(p1)
you could type the namespace of the project.
在Log.Log(p1)之前,您可以键入项目的命名空间。
Like this: Namespace.Log.Log(p1)
(Namespace could be the project name)
像这样:Namespace.Log.Log(p1)(Namespace可能是项目名称)
And the Optional Parameter should have a default value like this:
而Optional参数应该有一个默认值,如下所示:
Public Shared Sub Log(p1 as integer, Optional p2 as integer = 0)
公共共享子日志(p1作为整数,可选p2作为整数= 0)