Hello i was trying to practice for an assessment and i got this error:
Here Is My CodeHTML Code:{"Conversion from string "Passed" to type 'Integer' is not valid."}
Code:Public Class Form1 Dim FrenchScore, GermanScore, SpanishScore As Single Dim French, German, Spanish As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Note Pass mark for all 3 is a score of 25 'French Scores FrenchScore = Val(InputBox("Please Enter Pupils French Score")) Do Until FrenchScore >= 1 And FrenchScore <= 40 And FrenchScore Mod 1 = 0 FrenchScore = Val(InputBox("Error Pupils grades cannot be a half mark or cannot be below 1 or over 40. Please enter Pupils Grade Again")) Loop 'German Scores GermanScore = Val(InputBox("Please Enter Pupils German Score")) Do Until FrenchScore >= 1 And GermanScore <= 40 And GermanScore Mod 1 = 0 GermanScore = Val(InputBox("Error Pupils grades cannot be a half mark or cannot be below 1 or over 40. Please enter Pupils Grade Again")) Loop 'Spanish Scores SpanishScore = Val(InputBox("Please Enter Pupils Spanish Score")) Do Until SpanishScore >= 1 And GermanScore <= 40 And SpanishScore Mod 1 = 0 SpanishScore = Val(InputBox("Error Pupils grades cannot be a half mark or cannot be below 1 or over 40. Please enter Pupils Grade Again")) Loop 'Checking If Passed or failed If FrenchScore <= 40 Then French = "Passed" Else French = "Failed" If GermanScore <= 40 Then German = "Passed" Else German = "Failed" If SpanishScore <= 40 Then Spanish = "Passed" Else Spanish = "Failed" 'Displaying MsgBox("The Pupil Has " & French, " French, " & German, " German and ") End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class




Reply With Quote