VB.Net Tutorial/Class Module/Structure Array — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 12:55, 26 мая 2010
Array of Structure
Structure Employee
Dim strName As String
Dim intSalary As Integer
End Structure
public class Test
public Shared Sub Main
Dim aryEmployees(15) As 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 = 0 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