[求助]vb写的小计算器,有点毛病,来看看哈
具体代码如下,毛病就是点=的时候不出结果啊,大家看看哪错了. Dim tf As Boolean Dim op1, op2 Dim i As Byte Private Sub Command1_Click(i As Integer) If Not tf Then Label1.Caption = Label1.Caption & i Else Label1.Caption = i tf = False End If End Sub
Private Sub Form_Load()
tf = False End Sub
Private Sub oper_Click(char As Integer) op1 = Label1.Caption i = char Label1.Caption = "" tf = False End Sub
Private Sub result_Click() op2 = Label1.Caption Select Case i Case i = "0" Label1.Caption = op1 + op2 Case i = "1" Label1.Caption = op1 - op2 Case i = "2" Label1.Caption = op1 * op2 Case i = "3" Label1.Caption = op1 / op2 End Select tf = True End Sub