Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Const PI = 3.14                    ' 设置圆周率常量
        Dim r, s As Single
        r = CSng(TextBox1.Text)         ' 将从文本框输入的数据转换为Single数据
        s = PI * r * r                      ' 计算圆面积
        Label3.Text = s                 ' 将计算结果输出到标签中
    End Sub

    Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        Label3.Visible = False             ' 将标签隐藏
        TextBox1.Clear()                ' 清空文本框中数据
        TextBox1.Focus()                ' 将光标移到文本框上
    End Sub
End Class
