ARC
Well-known member
In VS, i added an item (bankroll.txt) and there's only 1 line of text on it:
2000
And I'm trying to assing that number (the only line in the text document) to a Public TotalMoney
But when I run it, TotalMoney stays at 0
::EDIT:: I noticed I dont have a catch for if it cant find the text document... so I took out the IfThen's and just left the instructions in... so it wasnt checking to see if the file existed first... and it gave me the following error at runtime:
2000
And I'm trying to assing that number (the only line in the text document) to a Public TotalMoney
But when I run it, TotalMoney stays at 0
VB.NET:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CurrentBet = 0
Dim ammount As String
Dim bankrollStreamReader As IO.StreamReader
If IO.File.Exists("bankroll.txt") Then
bankrollStreamReader = IO.File.OpenText("bankroll.txt")
ammount = bankrollStreamReader.ReadLine()
TotalMoney = CStr(ammount)
bankrollStreamReader.Close()
End If
Me.moneylabel.Text = "Total Money: $" + CStr(TotalMoney)
End Sub
::EDIT:: I noticed I dont have a catch for if it cant find the text document... so I took out the IfThen's and just left the instructions in... so it wasnt checking to see if the file existed first... and it gave me the following error at runtime:
VB.NET:
Could not find file 'D:\Data\Visual Studio 2005\Projects\SingleGambit\SingleGambit\bin\Release\bankroll.txt'.
Last edited: