关于VB的问题,急啊~~!!!

来源:百度知道 编辑:UC知道 时间:2024/05/15 01:35:04
1.输入圆的半径,计算并输出圆的面积,要求:创建一个文本框控件用于输入,单击命令按钮后通过标签控件显示计算结果,试写出相应的事件。
2.在文本框控件Text1、Text2中输入两个数x,y,仅当x>y时,交换x、y值,然后输出x、y的值到Label1,Label2控件。
3.自行设计界面,求:s=1*2*3*……*10的结果。
求写下代码,还有必要说明什么的,具体VB不是很懂的..在此先谢谢了

1,
Private Sub Command1_Click()
Dim x As Integer
x = Text1.Text
Label1.Caption = 3.14 * x * x
End Sub
2,
Private Sub Command1_Click()
Dim x, y As Integer
x = Text1.Text
y = Text2.Text
If (x > y) Then
Label1.Caption = x
Label2.Caption = y
End If
End Sub

3,
Private Sub Command1_Click()
Dim x, y As Integer
x = 1
For y = 1 To 10 Step 1
x = x * y
Next
Text1.Text = x
End Sub

有类似的 原代码,要的留邮箱。。。等到12点

文本框,按钮,标签名默认
1.
private sub command1_click()
dim r,s as single
r=csng(text1.text)
s=3.14159 * r^2
label1.caption="圆的面积为:" & s
end sub
2.
private sub command1_click()
dim x,y,t as single
x = text1.text
y = text2.text
if x>y then
t=x
x=y
y=t
end if
label1.caption=x
label2.caption=y
end sub
3.
private sub command1_click()
n=cint(text1