[Visual C#]
public ICommand MyCommand
{
get
{
if (this.myCommand == null)
{
this.myCommand = new RelayCommand(this.ShowMyCommand);
}
return this.myCommand;
}
}
private void ShowMyCommand(object param)
{
...
}
This code works fine, but when I convert it to Visual Basic:
[Visual Basic]
Private _myCommand As RelayCommand
Public ReadOnly Property MyCommand As ICommand
Get
If Me._myCommand Is Nothing Then
Me._myCommand = New RelayCommand(Me.ShowMyCommand)
End If
Return Me._myCommand
End Get
End Property
Private Sub ShowMyCommand(ByVal param As Object)
...
End Sub
I get the error:
Error 3 Argument not specified for
parameter ‘param’ of ‘Private Sub
ShowMyCommand(param As Object)’.
Any ideas? I am just doing blind conversion so I don’t understand what the project does, I am just converting it.
I am a bit on thin ice when it comes to VB, but according to what I know, you need to prefix the method name with the keyword
AddressOfin order for it to be usable as a method group for the event.The following line:
Needs to be written as:
The error message is because the compiler is trying to compile a call to the method, and is thus missing the argument to its parameter.