谁能帮我翻译一下这些VB语言的意思!

来源:百度知道 编辑:UC知道 时间:2024/06/17 13:42:35
一句一句的翻译!
Private Sub Command1_Click()
Dim x, y, z, result As Double
If IsNumeric(Text1.Text) And IsNumeric(Text2.Text) _
And IsNumeric(Text3.Text) Then
x = CDbl(Text1.Text)
y = CDbl(Text2.Text)
z = CDbl(Text3.Text)
If (x > 0) And (x < 10) And (y < 0) Or (y > 20) _
And (z > 10) And (z < 30) Then
result = x * x + y * y + z * z
Text4.Text = Str(result)
Else
MsgBox "请输入正确的数值!", 48
End If

Else
MsgBox "请输入数字!", 48
End If

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If

End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1_Click
End If
End Sub

Private Sub Command1_Click() '以下为单击command1事件
Dim x, y, z, result As Double '定义x,y,z为 Variant型变量,result为双精型变量
If IsNumeric(Text1.Text) And IsNumeric(Text2.Text) _
And IsNumeric(Text3.Text) Then '判断Text1、Text2、Text3的内容是否为数字,如是则往下运行,否 则 运 行 else*
x = CDbl(Text1.Text) '以下三句均为把TextBox中的内容转换为双精型数据,并分别赋给x,y,z
y = CDbl(Text2.Text)
z = CDbl(Text3.Text)
If (x > 0) And (x < 10) And (y < 0) Or (y > 20) _
And (z > 10) And (z < 30) Then '判断x是否为0到10的数,y是否为负数或大于20的数,z是否为10到30的数,不满足去else**
result = x * x + y * y + z * z '把x,y,z的平方和赋给result
Text4.Text = Str(result) '在Text4中显示result的值
Else 'else*
MsgBox "请输入正确的数值!", 48 '若输入的数字不符合范围则警告
End If
Else 'else**
MsgBox "请输入数字!", 48 '若TextBox中不是数字则警告
End If
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer) '往text1输入内容事件
If KeyAscii = 13 Then '判断