[mono-vb] functions parameter order example

Rolf Bjarne Kvinge rolflists at ya.com
Mon Apr 13 05:16:10 EDT 2009


Hi,

> cut here.
> Imports System
>     Public Module Test
>         Public Function Add(ByVal Num1 As Integer, ByVal Num2 As
> Double) As
>      Double
>             Return Num1 + Num2
>         End Function
> 
>         Public Function Add(ByVal Num2 As Double, ByVal Num1 As
> Integer) As
>      Double
>             Return Num1 - Num2
>         End Function
> 
>         Sub Main()
> 
>             Dim Num3 As Double = Add(2, 4.2)
>             Dim Num4 As Double = Add(4.2 , 2)
> 
>             Console.WriteLine("The first Add Method " & Num3)
>             Console.WriteLine("The Second Add Method " & Num4)
> 
>         End Sub
>     End Module
> 
> I used a cut and paste facility in speakup-linux to copy this example
> into this message.  When I try to compile it using vbnc, I get a less
> generic error 

This works for me, so likely you have an older version of vbnc installed.

Try downloading 2.4 here:
http://www.go-mono.com/mono-downloads/download.html

Rolf

> and not 6.2 and 2.2 as the results for the first add method and
> second add method respectively.  The error gets generated on the second
> add method output line strangely enough.  I would have thought the
> error
> would have happened further up in the program where the calculation
> happened but that wasn't the case over here.  This came from
> http://www.java2s.com in the vb.net tutorial -> class modules ->
> argument
> order link.
> 
> 
> _______________________________________________
> Mono-vb mailing list
> Mono-vb at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-vb



More information about the Mono-vb mailing list