如何从组合框中的值中删除无效的强制转换表达式以适合中的方程式examgrade
?
我试图通过在 MSDN 等上查找它来解决它,但无法弄清楚。我尝试使用Examgrade = ().ToString
,但没有奏效。
希望你们能指出我正确的方向。仅供参考,这是我的第一个真正的程序,我在 C# 中成功制作过一次,但删除了源文件,所以这是 Visual Basic,而且很容易做到这一点。
星号标记问题行
Public Class Calculator
Dim quarter3 As Integer
Dim quarter4 As Integer
Dim desiredgrade As String
Dim examgrade As String
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
quarter3 = TextBox1.Text
quarter4 = TextBox2.Text
desiredgrade = ComboBox1.Text
****examgrade = ((desiredgrade - (quarter3 * 0.4) - _
(quarter4 * 0.4)) / 0.2)****
If examgrade > 100 Then
Label5.Text = examgrade + " YOLO"
ElseIf examgrade < 0 Then
Label5.Text = "Impossible"
Else
Label5.Text = examgrade
End If
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender _
As System.Object, ByVal e As System.EventArgs) Handles _
ComboBox1.SelectedIndexChanged
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim D As Integer
A = 90
B = 80
C = 70
D = 60
ComboBox1.EndUpdate()
End Sub
End Class