Use Structure as Function parameter : Structure « Class Module « VB.Net Tutorial






public Structure CustomerBalance
    Dim decBalSavings As Decimal
    Dim decBalChecking As Decimal
End Structure


public class Test
   public Shared Sub Main

        Dim udtBalance As CustomerBalance
        

        udtBalance = GetCustomerBalance(1)
        Console.WriteLine(udtBalance.decBalChecking)
        Console.WriteLine(udtBalance.decBalSavings)
   End Sub
   Shared Function GetCustomerBalance(ByVal intCustomerID As Integer) As CustomerBalance

        Dim udtBalance As CustomerBalance

        udtBalance.decBalChecking = CDec(1000 + 4000 * Rnd())
        udtBalance.decBalSavings = CDec(1000 + 15000 * Rnd())
        Return udtBalance

    End Function
   
End class
3822.19
9001.36








6.46.Structure
6.46.1.Structure
6.46.2.Define and use Structure
6.46.3.Define and use structure with modifier
6.46.4.Define Structure
6.46.5.By value or by reference
6.46.6.Use Structure as Function parameter
6.46.7.Use With and Structure
6.46.8.Class Vs Structure in ByValue and ByRef
6.46.9.structure implements interface