Array of Structure : Structure Array « Class Module « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » Class Module » Structure Array 
6.47.1.Array of Structure
Structure Employee
    Dim strName As String
    Dim intSalary As Integer
End Structure


public class Test
   public Shared Sub Main
        Dim aryEmployees(15As Employee
        Dim intCounter As Integer

        aryEmployees(0).strName = "J"
        aryEmployees(0).intSalary = 3
        aryEmployees(1).strName = "B"
        aryEmployees(1).intSalary = 6

        'Set other array elements here.

        aryEmployees(15).strName = "P"
        aryEmployees(15).intSalary = 1

        'Show the elements of the array.
        For intCounter = To 15
            Console.WriteLine("Array element: " & intCounter & vbCrLf & _
                   "Name: " & aryEmployees(intCounter).strName & vbCrLf & _
                   "Salary: " & aryEmployees(intCounter).intSalary)
        Next intCounter
   End Sub


End class
Array element: 0
Name: J
Salary: 3
Array element: 1
Name: B
Salary: 6
Array element: 2
Name:
Salary: 0
Array element: 3
Name:
Salary: 0
Array element: 4
Name:
Salary: 0
Array element: 5
Name:
Salary: 0
Array element: 6
Name:
Salary: 0
Array element: 7
Name:
Salary: 0
Array element: 8
Name:
Salary: 0
Array element: 9
Name:
Salary: 0
Array element: 10
Name:
Salary: 0
Array element: 11
Name:
Salary: 0
Array element: 12
Name:
Salary: 0
Array element: 13
Name:
Salary: 0
Array element: 14
Name:
Salary: 0
Array element: 15
Name: P
Salary: 1
6.47.Structure Array
6.47.1.Array of Structure
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.