Imports System.IO Public Class Form1 Dim names() As String Dim pins() As String Dim acctnums() As String Dim balances() As Double Dim index As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click checkpin() End Sub Sub checkpin() Dim acctin, pinnum As String, found As Boolean = False acctin = InputBox("Enter account number: ", "Get Acct").Trim For i As Integer = 1 To names.GetUpperBound(0) If acctin = acctnums(i) Then found = True index = i Exit For End If Next If found Then For numtimes As Integer = 1 To 3 pinnum = InputBox("Enter pin #: ", "Get Pin") If pinnum = pins(index) Then MsgBox("Welcome, " & names(index), , "Welcome") Label2.Show() Label2.Text = "Welcome, " & names(index) ListBox1.Show() Button1.Hide() Button2.Show() Button3.Show() Button4.Show() Exit For End If Next Else MsgBox("You do not have an account!", , "Exiting ATM") End End If End Sub Sub printreport() Dim fmtstr As String = "{0,-10}{1,20}{2,10}" Dim Now As DateTime = DateTime.Now With ListBox1.Items .Clear() .Add("Account summary on: " & Now) .Add("") .Add(String.Format(fmtstr, "Name", "Account Number", "Balance")) .Add("=================================================") .Add(String.Format(fmtstr, names(index), acctnums(index), balances(index))) End With End Sub Sub deposit() Dim amt As Double amt = CDbl(InputBox("Enter amount to deposit", "Get Amt")) 'Need to do error checking balances(index) += amt End Sub Sub withdraw() Dim amt As Double amt = CDbl(InputBox("Enter amount to withdraw", "Get Amt")) 'Need to do error checking balances(index) -= amt End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Button1.Text = "Push to begin" Button2.Text = "Push to withdraw" Button3.Text = "Push to deposit" Button4.Text = "Push for balance" Button5.Text = "Exit" Me.Text = "Queens Bank" Dim sr As StreamReader sr = File.OpenText("h:\accts.txt") Dim numlines As Integer While sr.Peek <> -1 numlines += 1 sr.ReadLine() End While numlines = (numlines - 1) / 3 ReDim names(numlines) ReDim balances(numlines) ReDim pins(numlines) ReDim acctnums(numlines) sr.Close() sr = File.OpenText("h:\accts.txt") For i As Integer = 1 To numlines names(i) = sr.ReadLine acctnums(i) = sr.ReadLine pins(i) = sr.ReadLine balances(i) = CDbl(sr.ReadLine) Next End Sub Sub showamt() printreport() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click withdraw() showamt() Button5.Show() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click deposit() showamt() Button5.Show() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click showamt() Button5.Show() End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click End End Sub End Class