How to call a function in VB.NET

  • Thread starter Thread starter Omega Warrior
  • Start date Start date
O

Omega Warrior

example:

Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

call NameOfTheFunction ' when i do this way i get an error: Argument is
not specified for a parametar?

And the Function is Public!

End Sub







Please help?
 
What is the function you are calling? Does that function have parameters?
It appears from the message that it does. By the way, you don't use the word
"call" anymore, that was VB 6.0 code.

Public Sub A()
Dim result As Boolean = B("something", 7)
End Sub

Public Function B(x As String, y As Short) As Boolean
...
End Sub
 
Omega Warrior said:
example:

Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

call NameOfTheFunction ' when i do this way i get an error: Argument is
not specified for a parametar?

And the Function is Public!

End Sub
Please post the header of the function you are trying to call. That way, we
can help you with proper syntax. In general, given that VB function
procedures return values, the syntax is:

LocalVariableOfReturnType = NameOfFunctionProcedure(arguments separated by
commas to match the parameter list)
 
Back
Top