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.Stream File
13.GUI
14.GUI Applications
15.2D Graphics
16.I18N Internationlization
17.Reflection
18.Regular Expressions
19.Security
20.Socket Network
21.Thread
22.Windows
23.XML
24.Database ADO.net
25.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » Class Module » Structure Array 
6.46.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.46.Structure Array
6.46.1.Array of Structure
w__ww___.__j__a__v___a___2s_._co__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.