Hi All,
Evidently I found the file because I don't get the error anymore but now I am having other problems. Is there away that I can verify whats in the file?
Here is the code I used
[code=vbnet]
'declare object reader, string variables and array count
Dim _strinterestRates(3) As String
Dim intArrayCount As Integer = 0
Dim objReader As IO.StreamReader
If System.IO.File.Exists("interestRates.txt") = True Then
objReader = IO.File.OpenText("interestRates.txt")
_strinterestRates(intArrayCount) = objReader.ReadLine()
Do While objReader.Peek <> -1 '-1 is the null value
_strinterestRates(intArrayCount) = objReader.ReadLine()
intArrayCount += 1 'add one to the array counter
Loop
objReader.Close()
Else : MessageBox.Show("The external interest rates file does not exist", "Mortgage Calculator", MessageBoxButtons.OK)
'Me.Close()
End If
'shows message box explaing how to use the calculator
MessageBox.Show("Select from the Predefined Loan Terms & Interest Rates" _
& " or input your own values and Enter the Amount of the Mortgage" _
& " and then press the Calculate Button to display Payment Amount")
End Sub
[\code]
Now the problem is that I am trying to use the external file to read into my buttons for the different loan terms.
Here is the code for that.
Private Sub RadioButton(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbtnLoanTerm1.CheckedChanged, rbtnLoanTerm2.CheckedChanged, rbtnLoanTerm3.CheckedChanged
Dim ThisButton As RadioButton
Dim dblLoanTerm() As Double = {7, 15, 30}
Dim _strinterestRates(3) As Double
Dim dblInterestRate As Double
ThisButton = CType(sender, RadioButton)
If ThisButton.Checked = rbtnLoanTerm1.Checked Then
Dim txtInterestRate = _strinterestRates(0)
'displays array position 0 in Interest Rate text box
Me.txtInterestRate.Text = dblInterestRate
'displays array position 0 in loan term text box
Me.txtLoanTerm.Text = dblLoanTerm(0)
End If
I cannot get it to get the numbers from the external file.
Please Help,
Ken