Private Sub Command1_Click()
If Val(Text1.Text) > 0 And Val(Text2.Text) > 0 Then
Label1.Caption = "長方形的面積為:" & Val(Text1.Text) * Val(Text2.Text)
Label2.Caption = "長方形的周長為:" & 2 * (Val(Text1.Text) + Val(Text2.Text))
Else
MsgBox "您輸入的數據不規範,請重新輸入!", , "提示"
End If
End Sub