VB编程题,两道

来源:百度知道 编辑:UC知道 时间:2024/06/25 01:34:01
1.输入圆的的半径r,利用单选按钮,选择计算面积或计算周长等。
2.在窗体上创建3个复选框和一个命令按钮,命令按钮的Caption属性为“显示”编写程序,单击命令按钮,根据3个复选按钮的情况,连接选中复选框的Caption属性值,并在窗体上输出

第一题
Dim c, s
Private Sub Option1_Click()
c = Val(Text1.Text) * 2 * 3.1415
Label1.Caption = "周长为:" & c
End Sub

Private Sub Option2_Click()
s = Val(Text1.Text) * Val(Text1.Text) * 3.1415
Label1.Caption = "面积为:" & s
End Sub
第二题
Private Sub Command1_Click()
If Check1.Value = 1 Then
Print Check1.Caption;
End If
If Check2.Value = 1 Then
Print Check2.Caption;
End If
If Check3.Value = 1 Then
Print Check3.Caption;
End If
End Sub

Private Sub Form_Load()
Command1.Caption = "显示"
End Sub