I am using VB for my major project and I'm stuck at the spot where trying to write to a comma seperated variable file
I have managed to read from it fine (line by line and looking for matches to certain inputs). Now I am stuck trying to output the changes made, to the file
When I try to perform the function that does the writing, no errors occur in the program, but it dosnt work. When I go and look back at the file, it's empty, and says (in exel) "Unable To Read File", then opens it anyway, but its empty. It opens without error in Notepad, empty too.
Here's the code:
-------------------------------------------------
Open datafile For Output As 1
While Not EOF(1)
Input #1, FileFirstName, FileLastName, FilePassword, FileAccnumber, FileAcc1Balance
If FileAccnumber = Accnumber Then
Select Case Feature
Case Is = "Withdraw"
* FileAcc1Balance = FileAcc1Balance - ChosenAmount
Case Is = "Deposit"
* FileAcc1Balance = FileAcc1Balance + ChosenAmount
Case Is = "Transfer"
* FileAcc1Balance = FileAcc1Balance - ChosenAmount
End Select
End If
If FileAccnumber = TransferAccount Then
* FileAcc1Balance = FileAcc1Balance + ChosenAmount
End If
Wend
Close #1
-------------------------------------------
I marked the lines where the changes are suposed to occur with *'s (on the left). I'm not sure the problem. Am I doing this all wrong? Am I leaving stuff out ? Or What ?
I'm sure this is a bit confusing (i suck at explaining), but any help would be nice as I am a bit of a noob at VB.
Cheers
I have managed to read from it fine (line by line and looking for matches to certain inputs). Now I am stuck trying to output the changes made, to the file
When I try to perform the function that does the writing, no errors occur in the program, but it dosnt work. When I go and look back at the file, it's empty, and says (in exel) "Unable To Read File", then opens it anyway, but its empty. It opens without error in Notepad, empty too.
Here's the code:
-------------------------------------------------
Open datafile For Output As 1
While Not EOF(1)
Input #1, FileFirstName, FileLastName, FilePassword, FileAccnumber, FileAcc1Balance
If FileAccnumber = Accnumber Then
Select Case Feature
Case Is = "Withdraw"
* FileAcc1Balance = FileAcc1Balance - ChosenAmount
Case Is = "Deposit"
* FileAcc1Balance = FileAcc1Balance + ChosenAmount
Case Is = "Transfer"
* FileAcc1Balance = FileAcc1Balance - ChosenAmount
End Select
End If
If FileAccnumber = TransferAccount Then
* FileAcc1Balance = FileAcc1Balance + ChosenAmount
End If
Wend
Close #1
-------------------------------------------
I marked the lines where the changes are suposed to occur with *'s (on the left). I'm not sure the problem. Am I doing this all wrong? Am I leaving stuff out ? Or What ?
I'm sure this is a bit confusing (i suck at explaining), but any help would be nice as I am a bit of a noob at VB.
Cheers