I am having another problem with a new project for my programming class. We have to create an ATM that the user enters the account and pin number to get to a main menu. The program consists of a form for each type of activity(logging on, the main menu, withdrawal, deposit, view balance) there is also a module that is used to create a structured array. This array has data loaded into it from a text file.

Dim reader As StreamReader
     reader = New StreamReader("Project12.txt")
     count = 0
     aAccounts(count).lastName = reader.ReadLine
     Do While aAccounts(count).lastName <> "-1"
        aAccounts(count).firstName = reader.ReadLine
        aAccounts(count).Account = reader.ReadLine
        aAccounts(count).PIN = reader.ReadLine
        aAccounts(count).Balance = reader.ReadLine
        count = count + 1
     ReDim Preserve aAccounts(count)
     aAccounts(count).lastName = reader.ReadLine
     Loop
     reader.Close()

Using an array search to determine which pointer is the user's, this is the only location changed such as
aAccounts(found).variable
The rest of the data is still in the aAccounts(count) structure.
Through logic and the use of the forms and data that the user inputs, the account balance will change, but I want this change to be the only thing saved over, preserving the rest of the records of the text file.

Sorry, nevermind, finally got it to work, but I am having problems with trying to subtract from a number only in multiples of 20, such as an ATM would allow only $20 to be withdrawn.

Member Avatar for iamthwee

Sorry, nevermind, finally got it to work, but I am having problems with trying to subtract from a number only in multiples of 20, such as an ATM would allow only $20 to be withdrawn.

Hint: Try experiementing with the Mod (modulus) function.

Member Avatar for iamthwee

Oh and for future reference please use code tags.

Read the watermark in the background.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.