Sunday, January 17, 2010

Declaration of Structure in VB.Net:

Module Module1

Sub Main()
Dim m As Mystruc = New Mystruc("sangram", "Maharashtra", 25)
m.DisplayDetails()
Console.ReadKey()
End Sub
Public Structure Mystruc
Public Age As Integer
Public Name As String
Public Native As String

Public Sub New(ByVal nam As String, ByVal nativ As String, ByVal ag As Integer)
Name = nam
Age = ag
Native = nativ
End Sub
Public Sub DisplayDetails()
Console.WriteLine("Name:" + Name)
Console.WriteLine("Native:" + Native)
Console.WriteLine("Age:" + Age.ToString())
End Sub



End Structure
End Module

No comments:

Post a Comment