- 0
- 0
- 约3.49万字
- 约 41页
- 2017-02-16 发布于北京
- 举报
《VB程序设计》课堂例题总结
消息对话框的使用
Private Sub Command1_Click()
If Not IsNumeric(Text1) Then
i% = MsgBox(你输入的不是数字!, 5 + vbQuestion, 警告)
If i = 4 Then Text1.SetFocus Else End
Else
MsgBox 你好, , 欢迎
End If
End Sub
求圆的周长与面积
Private Sub Form_Click()
Dim r!, s!, c!
Const pi = 3.14159 ‘用户声明常量
r = InputBox(请输入园的半径:)
s = pi * r * r
c = 2 * pi * r
MsgBox 园的周长为: c 面积为: s
End Sub
计算三角形的面积
Private Sub Command1_Click()
Dim a%, b%, c%, s#, area#
Dim str1$
a = Val(InputBox(a:))
b = Val(InputBox(b:))
c = Val(InputBox(c:))
s = (a + b + c) / 2
原创力文档

文档评论(0)