erorr saying Cast from string "67 85 90 " to type 'Double' is not valid. I don't even
This is just the code I have typed so far.
Ok the problem I am having is the line Vavg = (vExam1 + vExam2 + vExam3 + vfinal * 2) / 5 when I get to this line the program pukes on me giving me an erorr saying Cast from string "67 85 90 " to type 'Double' is not valid. I don't even have Double typed what am I doing wrong?
Visual Basic:
Dim vfstudentG As String
Dim vsocSec As String
Dim vExam1, vExam2, vExam3, vfinal, vAvg, vtotal As String
Dim fmtstr As String = "{0,-15}{1,8:n}"
Private Sub btncompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncompute.Click
lstout.Items.Clear()
lstout.Items.Add(String.Format(fmtstr, "Soc.Sec.No.", _
"Average" ))
FileOpen(1, "student grades.txt", OpenMode.Input)
Input(1, vfstudentG)
vsocSec = vfstudentG.Substring(0, 11)
vExam1 = vfstudentG.Substring(12, 3)
vExam2 = vfstudentG.Substring(15, 3)
vExam3 = vfstudentG.Substring(18, 3)
vfinal = vfstudentG.Substring(21)
vAvg = (vExam1 + vExam2 + vExam3 + vfinal * 2) / 5
lstout.Items.Add(String.Format(fmtstr, vsocSec, vAvg))
vtotal = vAvg
End Sub
End Class
Ok the problem I am having is the line Vavg = (vExam1 + vExam2 + vExam3 + vfinal * 2) / 5 when I get to this line the program pukes on me giving me an erorr saying Cast from string "67 85 90 " to type 'Double' is not valid. I don't even have Double typed what am I doing wrong?
Last edited by a moderator: