Private Sub Command1_Click()
Text3.Text = ""
If Val(Text1.Text) = 0 Then
MsgBox "第一个数不能为空或包含字符!"
Exit Sub
End If
If Val(Text2.Text) = 0 Then
MsgBox "第二个数不能为空或包含字符!"
Exit Sub
End If
Text3.Text = Val(Text1.Text) ^ 2 + Val(Text2.Text) ^ 2
End Sub
Private Sub Form_Load()
Command1.Caption = "计算"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
a=val(text1.text)
b=val(text2.text)
c=a+b
text3.text=str(c)