Wednesday, March 5, 2008

Structs of VB.

_____________________________________________

Structs of VB.

_____________________________________________

Structure StudentRecord
Public name As String
Public gpa As Single

Public Sub New(ByVal name As String, ByVal gpa As Single)
Me.name = name
Me.gpa = gpa
End Sub
End Structure

Dim stu As StudentRecord = New StudentRecord("Bob", 3.5)
Dim stu2 As StudentRecord = stu

stu2.name = "Sue"
Console.WriteLine(stu.name) ' Prints Bob
Console.WriteLine(stu2.name) ' Prints Sue

____________________________________________________________________

Note:Applicable for .net also asp.net.
____________________________________________________________________

No comments: