相关代码示例:
Public Class Form1
Private Sub bt_7_Click(sender As Object, e As EventArgs) Handles bt_7.Click
TextBox1.AppendText(7)
End Sub
Private Sub bt_8_Click(sender As Object, e As EventArgs) Handles bt_8.Click
TextBox1.AppendText(8)
End Sub
Private Sub bt_10_Click(sender As Object, e As EventArgs) Handles bt_10.Click
TextBox1.AppendText(10)
End Sub
Private Sub bt_j_Click(sender As Object, e As EventArgs) Handles bt_j.Click
TextBox1.AppendText("-")
End Sub
Private Sub bt_4_Click(sender As Object, e As EventArgs) Handles bt_4.Click
TextBox1.AppendText(4)
End Sub
Private Sub bt_5_Click(sender As Object, e As EventArgs) Handles bt_5.Click
TextBox1.AppendText(5)
End Sub
Private Sub bt_6_Click(sender As Object, e As EventArgs) Handles bt_6.Click
TextBox1.AppendText(6)
End Sub
Private Sub bt_jh_Click(sender As Object, e As EventArgs) Handles bt_jh.Click
TextBox1.AppendText("+")
End Sub
Private Sub bt_1_Click(sender As Object, e As EventArgs) Handles bt_1.Click
TextBox1.AppendText(1)
End Sub
Private Sub bt_2_Click(sender As Object, e As EventArgs) Handles bt_2.Click
TextBox1.AppendText(2)
End Sub
Private Sub bt_3_Click(sender As Object, e As EventArgs) Handles bt_3.Click
TextBox1.AppendText(3)
End Sub
Private Sub bt_c_Click(sender As Object, e As EventArgs) Handles bt_c.Click
TextBox1.AppendText("*")
End Sub
Private Sub bt_0_Click(sender As Object, e As EventArgs) Handles bt_0.Click
TextBox1.AppendText(0)
End Sub
Private Sub bt_ch_Click(sender As Object, e As EventArgs) Handles bt_ch.Click
TextBox1.AppendText("/")
End Sub
Private Sub bt_d_Click(sender As Object, e As EventArgs) Handles bt_d.Click
TextBox1.AppendText(".")
End Sub
Private Sub bt_res_Click(sender As Object, e As EventArgs) Handles bt_res.Click
Dim vbs As Object
vbs = CreateObject("MSScriptControl.ScriptControl")
vbs.Language = "VBScript"
On Error GoTo Err
TextBox2.Text = vbs.eval(TextBox1.Text)
Err:
If vbs.Error.number <> 0 Then
MsgBox("错误代号:" & vbs.Error.number & vbCrLf &
"错误信息:" & vbs.Error.Description & vbCrLf &
"错误行号:" & vbs.Error.Line & vbCrLf &
"错误列号:" & vbs.Error.Column)
End If
End Sub
End Class