Hi,
In the following code (Class & Form1), I'm trying to figure out the following:
- Create an array that stores the 'Clients' (first name, last name, account number)
- 'Button List' the array with the (First Name , Last Name , Array Value , Account Balance)
I attached the output and the code to make it more clear and I appreciate the help.
Thank you.
This is the Class code:
Public Class BankAccountClass
'Private "Protected" variable
Private FName As String
Private LName As String
Private AcctNum As String
Private Bal As Decimal
Public Property FirstName As String
Get
Return FName
End Get
Set(ByVal value As String)
FName = value
End Set
End Property
Public Property LastName As String
Get
Return LName
End Get
Set(ByVal value As String)
LName = value
End Set
End Property
Public Property AccountNumber As String
Get
Return AcctNum
End Get
Set(ByVal value As String)
AcctNum = value
End Set
End Property
Public Property Balance As Decimal
Get
Return Bal
End Get
Set(ByVal value As Decimal)
Bal = value
End Set
End Property
End Class
And here is the Form1 Code
Public Class Form1
Public ClientRecords(-1) As BankAccountClass
Private Sub ButtonAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAdd.Click
Dim AClient As New BankAccountClass
AClient.FirstName = InputBox("Enter first name", "Enter")
AClient.LastName = InputBox("Enter last name", "Enter")
AClient.AccountNumber = InputBox("Deposit Amount", "Bank Account Program")
ReDim Preserve ClientRecords(ClientRecords.Length)
ClientRecords(ClientRecords.Length - 1) = AClient
' BankCustomer.AccountNumber = Integer.Parse(AllCustomers.Length + 1)
End Sub
Private Sub ButtonDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDisplay.Click
End Sub
Private Sub ButtonList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonList.Click
TextBoxDisplay.Text = ""
TextBoxDisplay.Text &= "Last Name" & vbTab & "First Name" & vbTab & "Array Number" & vbTab & "Account" & vbCrLf
For Each MyStudents As BankAccountClass In ClientRecords
TextBoxDisplay.Text &= MyStudents.LastName & vbTab & vbTab & MyStudents.FirstName & vbTab & vbTab & "Array Value" & vbTab & MyStudents.AccountNumber & vbCrLf
Next
End Sub
End Class