这是我的想法:
1)导入包含一些基本数学问题的文件
2)您阅读文件并将其中所写的内容复制到标签
但是当我试图计算我遇到了问题时,
这是我所拥有的代码的示例:
Dim Five As Integer = 5
Dim Six As Integer = 6
Dim Plus As String = "+"
If Five Plus Six = 9 then
End If
当我将鼠标移到代码上时,它说:
预期结束语
我该怎么做才能解决它?
抱歉我的英语不好,这不是我的主要语言。
答案 0 :(得分:2)
您可以尝试解析您的运营商。像这样:
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