1 / 10

Visual Basic 程序设计

Visual Basic 程序设计. —— 第 3 章 顺序结构程序设计. InputBox 函数和 MsgBox 函数 ⒈ InputBox 函数 InputBox 函数也称为输入对话框,用户在对话框中输入的信息作为字符串返回。 格式: < 变量名 > = InputBox([< 提示信息 >][ , [< 对话框标题 >][ , < 默认值 >]]. ⒉ MsgBox 函数和 Msgbox 过程 MsgBox 函数也称为消息对话框,功能是在对话框中显示信息,等待用户单击按钮,用户单击按钮后返回一个整数以标明单击了哪个按钮。

Download Presentation

Visual Basic 程序设计

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Visual Basic程序设计 ——第3章 顺序结构程序设计

  2. InputBox函数和MsgBox函数 • ⒈ InputBox函数 • InputBox函数也称为输入对话框,用户在对话框中输入的信息作为字符串返回。 • 格式:<变量名> = InputBox([<提示信息>][,[<对话框标题>][,<默认值>]]

  3. ⒉ MsgBox函数和Msgbox过程 • MsgBox函数也称为消息对话框,功能是在对话框中显示信息,等待用户单击按钮,用户单击按钮后返回一个整数以标明单击了哪个按钮。 • 过程使用格式:Msgbox <提示信息> [,<对话框类型>][,<对话框标题>] • 函数使用格式:<变量名> = MsgBox(<提示信息> [,<对话框类型>][,<对话框标题>])

  4. 例:对用户任意输入的半径,计算并显示相应的圆面积例:对用户任意输入的半径,计算并显示相应的圆面积 (1)用文本框、标签 (2)用inputbox函数、msgbox语句

  5. 1、常见语句:定义语句和赋值语句的正确使用。1、常见语句:定义语句和赋值语句的正确使用。 2、数据的输入、输出方法 输入:赋值语句、text、inputbox 输出:print方法、text、msgbox、标签

  6. 图3.1 顺序结构图3.2 选择结构

  7. 图3.3 循环结构流程图

  8. 输入三个数,然后输出其中最大的数,用算法用流程图表示如图3.4所示。输入三个数,然后输出其中最大的数,用算法用流程图表示如图3.4所示。

  9. 顺序程序结构 dim r,s as single r=text1.text s=3.1415926*r*r label1.caption=“s=“ &s • 选择程序结构 • 循环程序结构

  10. 输入一个三位正整数M,输出它的百位数、十位数、个位数。输入一个三位正整数M,输出它的百位数、十位数、个位数。

More Related