新人请教高手翻译点VB语句,拜托拜托!

来源:百度知道 编辑:UC知道 时间:2024/05/16 09:41:04
Private Sub Command2_Click(eex As Integer)
If b = 0 Or eex = 4 Then
If e = 0 Then
c = c + Val(text1.Caption)
ElseIf e = 1 Then
c = c - Val(text1.Caption)
ElseIf e = 2 Then
If Val(text1.Caption) = 0 Then
MsgBox ("非法,值不能是零")
Exit Sub
Else
c = c / Val(text1.Caption)
End If
ElseIf e = 3 Then
c = c * Val(text1.Caption)
End If
text1.Caption = Str(c)
d = 0
End If
b = 1
e = eex
a = 0
End Sub

Private Sub Command7_Click()
If (text1.Caption <> "") Then
text1.Caption = Mid(text1.Caption, 1, Len(text1.Caption) - 1)
End If
End Sub

简单计算器

你的程序是一个程序的其中一段,我只能解是每一句,但说不上整个功能是什么。只见树木,不见森林。
Private Sub Command2_Click(eex As Integer)
If b = 0 Or eex = 4 Then
If e = 0 Then
c = c + Val(text1.Caption)
ElseIf e = 1 Then
c = c - Val(text1.Caption)
ElseIf e = 2 Then
If Val(text1.Caption) = 0 Then
MsgBox ("非法,值不能是零")
Exit Sub
Else
c = c / Val(text1.Caption)
End If
ElseIf e = 3 Then
c = c * Val(text1.Caption)
End If
text1.Caption = Str(c)
d = 0
End If
b = 1
e = eex
a = 0
End Sub

一段的大体意思是,C变量的取值问题,C 取值由三个变量控制。b,eex,e .不同的值条件,C取不同的值。C取到值后,把变量给TEXT1

Private Sub Command7_Click()
If (text1.Caption <> "") Then
text1.Caption = Mid(text1.Caption, 1, Len(text1.Caption) - 1)
End If
End Sub

如果text1里不为空,那么TEXT1取值在第一个,到总长度的前一个之间。