Presentation is loading. Please wait.

Presentation is loading. Please wait.

初识Visual Basic.

Similar presentations


Presentation on theme: "初识Visual Basic."— Presentation transcript:

1 初识Visual Basic

2 VB 6.0简介 Microsoft Visual Basic 6.0

3 1、第一个应用程序 Private Sub Command1_Click() Label1.Caption = "Hello World"
End Sub Private Sub Command2_Click() End Private Sub Form_Load() Me.Caption = "第一个VB应用程序" Label1.Font = "宋体" Label1.FontSize = 10 Label1.FontBold = True

4 2、计算圆的面积 Private Sub Form_click() Dim r As Single Const PI As Single = 3.14 Dim s As Single r = InputBox("输入r") s = PI * r ^ 2 Print s End Sub InputBox是Visual Basic和VBS中的函数,功能是弹出一个对话框,在其中显示提示,等待用户输入文字并按下按钮,然后返回用户输入的文字。

5 2、计算圆的面积 Private Sub Form_click() Dim r As Single '定义半径r为单精度(变量) Const PI As Single = 3.14 '定义PI为单精度(常量) Dim s As Single '定义面积S为单精度(变量) r = InputBox("输入r") '半径r通过inputbox函数输入值 s = PI * r ^ 2 '用求圆面积公式,并把值赋给S Print s '在窗体上打印出S的值 End Sub

6 3、制作登陆界面


Download ppt "初识Visual Basic."

Similar presentations


Ads by Google