Reputation: 41
This is my idea:
You import a file with some basic math questions
You read the file and copy what's written in it to a label
But when I try to calculate I am having a problem,
This is an example of the code I am having:
Dim Five As Integer = 5
Dim Six As Integer = 6
Dim Plus As String = "+"
If Five Plus Six = 9 then
End If
When I move my mouse over the code it says:
End of statement expected
What can I do to fix it?
Upvotes: 1
Views: 108
Reputation: 2370
You could try parsing for your operator. Something like this:
Private Function doCalcs() As String
Dim Five As Integer = 5
Dim Six As Integer = 6
Dim Plus As String = "+"
Dim result As Integer
Select Case Plus
Case "+"
result = Five + Six
Case "-"
result = Five - Six
Case Else
result = -1 'or error handler
End Select
Return result
End Function
Upvotes: 3