计算器(COMMAND控件数组的原代码)
各位大哥,小弟是初学者,正在试编一计算器,可程序老是出错,我想在此请高手给我COMMAND控件数组的原码,知道的朋友请给我回话,不胜感激!
Dim flag As Boolean Dim num1 As Integer Dim num2 As Integer Private Sub Command1_Click(Index As Integer) Select Case Index Case 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 Text1.Text = Text1.Text & Index Case 10 If flag Then Text1.Text = Text1.Text & "." End If flag = False Case 12, 13, 14, 15 num1 = Val(Text1.Text) Text1.Text = "" flag = True Case Is = 11 Text1.Text = Val(Text1.Text) * num1 flag = True End Sub
Private Sub Form_Load() flag = True num1 = 0 num2 = 0 End Sub 这是我写的代代码,可不知是哪里出错了。