Dim spy As New CSpy
Dim spyList(5) As CSpy
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'spyList(2).fname = "Bob"
Dim counter As Integer = 0
For Each spy In spyList
Label1.Text = CStr(counter) + spyList(counter).fname + vbCrLf
counter += 1
Next
End Sub
Public Class CSpy
' Spy details include:
' first name
' last name
' code name
' age
' sex
' distinguishing marks
' specialist skills
' bank account number
' total pay to date
' amount due to spy
Public fname As String
Public lname As String
Public cname As String
Public age As Integer
Public marks As String
Public skills As String
Public bank_number As Double
Private paid As Double
Private due As Double
Public Sub addSpy(ByVal fname_p As String, ByVal lname_p As String, ByVal cname_p As String, ByVal age_p As Integer, ByVal marks_p As String, ByVal skills_p As String, ByVal bank_number_p As Integer, Optional ByVal paid_p As Double = 0, Optional ByVal due_p As Double = 0)
'Initiate the spy details through a subroutine
'therefor error checking can be done within the method
fname = LCase(fname_p)
lname = LCase(lname_p)
cname = cname_p
age = age_p
marks = marks_p
skills = skills_p
bank_number = bank_number_p
paid = paid_p
due = due_p
End Sub
End Class