📄 3.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=GB2312">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="./3.files/filelist.xml">
<title>无标题文档</title>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>oem</o:Author>
<o:Template>Normal</o:Template>
<o:LastAuthor>oem</o:LastAuthor>
<o:Revision>5</o:Revision>
<o:TotalTime>39</o:TotalTime>
<o:LastPrinted>2006-07-01T05:49:00Z</o:LastPrinted>
<o:Created>2006-06-30T23:30:00Z</o:Created>
<o:LastSaved>2006-07-01T05:49:00Z</o:LastSaved>
<o:Pages>11</o:Pages>
<o:Words>1574</o:Words>
<o:Characters>8972</o:Characters>
<o:Lines>74</o:Lines>
<o:Paragraphs>17</o:Paragraphs>
<o:CharactersWithSpaces>11018</o:CharactersWithSpaces>
<o:Version>9.2812</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:Zoom>80</w:Zoom>
<w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing>
<w:Compatibility>
<w:UseFELayout/>
</w:Compatibility>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:宋体;
mso-bidi-font-family:"Times New Roman";}
h2
{margin-right:0cm;
mso-margin-top-alt:auto;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
mso-outline-level:2;
font-size:18.0pt;
font-family:宋体;
font-weight:bold;}
p.MsoFooter, li.MsoFooter, div.MsoFooter
{margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:center 207.65pt right 415.3pt;
layout-grid-mode:char;
font-size:9.0pt;
font-family:宋体;
mso-bidi-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{color:blue;
text-decoration:underline;
text-underline:single;}
p
{margin-right:0cm;
mso-margin-top-alt:auto;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:宋体;
mso-bidi-font-family:"Times New Roman";}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:42.55pt;
mso-footer-margin:49.6pt;
mso-page-numbers:42;
mso-even-footer:url("./3.files/header.htm") ef1;
mso-footer:url("./3.files/header.htm") f1;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=ZH-CN link=blue vlink=blue style='tab-interval:21.0pt'>
<div class=Section1>
<h2>第三章<span lang=EN-US> VB的程序设计基础 <o:p></o:p></span></h2>
<p style='text-indent:132.25pt;mso-char-indent-count:10.98;mso-char-indent-size:
12.0pt;mso-char-indent-size:12pt'><strong><span lang=EN-US>1 VB 编码规则 </span></strong></p>
<p><strong><span lang=EN-US>1. 语言元素 </span></strong></p>
<p> <span lang=EN-US>VB 的语言基础是 BASIC 语言, VB 程序的语言元素主要由: </span></p>
<p><strong>关键字 </strong>(如:<span lang=EN-US> Dim 、 Print 、 Cls ) </span></p>
<p><strong>函数 </strong>(如:<span lang=EN-US> Sin ()、 Cos () Sqr ()) </span></p>
<p><strong>表达式 </strong>(如:<span lang=EN-US> Abs(-23.5)+45*20/3 ) </span></p>
<p><strong>语句 </strong>(如:<span lang=EN-US> X=X+5 、 IF …… ELSE …… END IF )等组成。 </span></p>
<p><strong><span lang=EN-US>2. VB 代码书写规则 </span></strong></p>
<p> (<span lang=EN-US>1) 程序中不区分字母的大小写, Ab 与 AB 等效; <br>
(2) 系统对用户程序代码进行自动转换: </span></p>
<p> <span lang=EN-US>1) 对于 VB 中的关键字,首字母被转换成大写,其余转换成小写 <br>
2) 若关键字由多个英文单词组成,则将每个单词的首字母转换成大写 <br>
3) 对于用户定义的变量、过程名,以第一次定义的为准,以后输入的自动转换成首次定义的形式 </span></p>
<p><strong><span lang=EN-US>3. 语句书写规则 </span></strong></p>
<p>(<span lang=EN-US>1) 在同一行上可以书写多行语句,语句间用冒号 ( <strong>: </strong>) 分隔 <br>
(2) 单行语句可以分多行书写,在本行后加续行符:空格和下划线 _ <br>
(3) 一行允许多达 255 个字符 </span></p>
<p><strong><span lang=EN-US>4. 程序的注释方式 </span></strong></p>
<p>(<span lang=EN-US>1) 整行注释一般以 Rem 开头,也可以用撇号 <strong>' </strong>; <br>
(2) 用撇号 <strong>' </strong>引导的注释,既可以是整行的,也可以直接放在语句的后面,最方便; <br>
(3) 可以利用“编辑”工具栏的 “设置注释块”、“解除注释块”来将设置多行注释。 </span></p>
<p><strong><span lang=EN-US>5. 保留行号和标号 </span></strong></p>
<p> <span lang=EN-US>VB 源程序接受行号与标号,但不是必须的(早期的 BASIC 语言中必须用行号)。 <br>
标号是以字母开始以冒号结束的字符串,一般用在 GOTO 语句(现在很少用)中。 </span></p>
<p class=MsoNormal><span lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></p>
<p align=center style='text-align:center'><strong><span lang=EN-US>2.2 VB 的语言基础
</span></strong></p>
<p><strong><span lang=EN-US>1. 数据类型 </span></strong></p>
<p align=center style='text-align:center'><strong> <span lang=EN-US>VB 的标准数据类型 </span></strong></p>
<table border=1 cellspacing=0 cellpadding=0 style='mso-cellspacing:0cm;
border:solid windowtext .5pt;mso-padding-alt:0cm 0cm 0cm 0cm'>
<tr>
<td width=108 colspan=2 style='width:81.0pt;border:solid windowtext .5pt;
padding:0cm 0cm 0cm 0cm'>
<p align=center style='text-align:center'><strong>数据类型 </strong></p>
</td>
<td width=72 style='width:54.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p align=center style='text-align:center'><strong>关键字 </strong></p>
</td>
<td width=57 style='width:42.75pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p align=center style='text-align:center'><strong>类型符 </strong></p>
</td>
<td width=51 style='width:38.25pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p align=center style='text-align:center'><strong>前缀 </strong></p>
</td>
<td width=96 style='width:72.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p align=center style='text-align:center'><strong>存储空间 </strong></p>
</td>
<td width=276 style='width:207.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p align=center style='text-align:center'><strong>范围 </strong></p>
</td>
</tr>
<tr>
<td width=36 rowspan=6 style='width:27.0pt;border:solid windowtext .5pt;
padding:0cm 0cm 0cm 0cm'>
<p>数值数据类型 </p>
</td>
<td width=72 style='width:54.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p>字节型 </p>
</td>
<td width=72 style='width:54.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p><strong><span lang=EN-US>Byte </span></strong></p>
</td>
<td width=57 style='width:42.75pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><span
lang=EN-US><o:p></o:p></span></p>
</td>
<td width=51 style='width:38.25pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p><span lang=EN-US>Byt </span></p>
</td>
<td width=96 style='width:72.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p align=center style='text-align:center'><span lang=EN-US>1 个字节 </span></p>
</td>
<td width=276 style='width:207.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p><span lang=EN-US>0 到 255 </span></p>
</td>
</tr>
<tr>
<td width=72 style='width:54.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p>整型 </p>
</td>
<td width=72 style='width:54.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p><strong><span lang=EN-US>Integer </span></strong></p>
</td>
<td width=57 style='width:42.75pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p align=center style='text-align:center'><span lang=EN-US>% </span></p>
</td>
<td width=51 style='width:38.25pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p><span lang=EN-US>Int </span></p>
</td>
<td width=96 style='width:72.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p align=center style='text-align:center'><span lang=EN-US>2 个字节 </span></p>
</td>
<td width=276 style='width:207.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p><span lang=EN-US>-32,768 到 32,767 </span></p>
</td>
</tr>
<tr>
<td width=72 style='width:54.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p>长整型 </p>
</td>
<td width=72 style='width:54.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p><strong><span lang=EN-US>Long </span></strong></p>
</td>
<td width=57 style='width:42.75pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p align=center style='text-align:center'><span lang=EN-US>&</SPAN>
</span></p>
</td>
<td width=51 style='width:38.25pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p><span lang=EN-US>Lng </span></p>
</td>
<td width=96 style='width:72.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p align=center style='text-align:center'><span lang=EN-US>4 个字节 </span></p>
</td>
<td width=276 style='width:207.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
<p><span lang=EN-US>-2,147,483,648 到 2,147,483,647 </span></p>
</td>
</tr>
<tr>
<td width=72 style='width:54.0pt;border:solid windowtext .5pt;padding:0cm 0cm 0cm 0cm'>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -