admin管理员组

文章数量:1530847

2023年12月12日发(作者:)

word格式-可编辑-感谢下载支持

附件1:外文资料翻译译文

Visual Basic简介

什么是Visual Basic

Microsoft Visual Basic 5.0是旧的BASIC语言最近的最好的化身,在一个包里给你一个完全的Windows应用开发系统。Visual Basic (我们常称它VB)能让你写、编辑,并且测试Windows应用程序。另外,VB有包括你能用来写并且编译帮助文件那的工具,ActiveX控制,并且甚至因特网应用程序

Visual Basic是它本身的一个Windows应用程序。你装载并且执行VB系统就好象你做其它Windows程序。你将使用这个运行的VB程序创造另外的程序。虽然VB是一个非常地有用的工具,但VB只是一个程序员(写程序的人)用来写, 测试,并且运行Windows应用程序的工具。

尽管程序员们经常可替交地使用术语程序和应用程序,当你正在描述一个Windows程序时术语应用程序似乎最适合,因为一个Windows程序由若干份代表性的文件组成。这些文件以工程形式一起工作。通过双击一个图标或由以Windows开始应用程序运行启动菜单用户从Windows加载并且运行工程产生最终的程序。

过去的45年与计算机硬件一起的编程工具的角色已经演变。今天一种程序语言,例如Visual Basic,一些年以前与程序语言的非常不一致。Windows操作系统的视觉的天性要求比一些年以前是可利用的更先进的工具。在windowed环境以前,一种程序语言是你用来写程序的一个简单的基于文章工具。今天你需要的不只是一种语言,你需要一种能在windows系统内部工作并且能利用所有的绘画、多媒体、联机和Windows提供的多处理活动开发应用软件的绘图开发工具。Visual Basic是如此的一种工具。超过一种语言,Visual

Basic让你产生与今天的Windows操作系统的每个方面互相影响的应用程序。如果在过去你已经注意Visual Basic,你将很惊讶今天的Visual Basic系统。现在VB创造独立的运行时刻的一个真实的编辑器.EXE文件比先前的VB程序更快速执行。VB也包括若干个提供逐步的对话框问题的奇才,这些对话框问题通过应用程序指导你。VB的开发平台,一个叫开发者工作室的发展环境,现在支持和先进的Visual C++,Visual J++ 编辑器一样的特征。因此,一旦你学习微软的视觉的编程产品的之一,你将能熟练的使用其它编程语言在学习其它编程语言时你前面没有很长的弯路。

语言

今天编程语言不再和它们以前一样。语言自己没变得不太重要,而是应用软件的绘画接口已经变得更重要。

一台计算机不能理解任何人的说的语言。一种口语,例如意大利或英语,简单地太全面并且不明确,计算机不能理解。因此,我们必须适应机器并且学习计算机能理解的一种语言。VB的程序语言是相当简单的并且在最多的部分使用普通的英语词和短语。然而,语言明确。当你用Visual Basic语言写声明时,在一样的上下文以内声明从来没有多样的意思。

word格式-可编辑-感谢下载支持

VB编程进程

当你想要使用可视化Basic时,你将跟随这些基本的步骤:

1. 开始可视化Basic。

2. 创造一个新应程序或装载一个存在的应用程序。当你创建一个新应用程序时,你可能想要使用Visual Basic的VB应用程序精灵来写你的程序的初始的外形。用Visual Basic提供的调试工具测试你的应用程序。调试的工具帮助你定位并且排除程序错误(bugs)。不管你尽最大的努力使他们出来,它们都能出现。

3. 编译你的程序进一个最终的应用程序。

4. 停止Visual Basic。

5. 分发应用程序到你的用户。

你将很少连续执行所有的这些步骤。6个步骤不是连续的步骤。但是你在完成你的应用程序前通过并且回到的阶段。

开始Visual Basic

你从Windows启动菜单启动Visual Basic。Visual Basic开发环境它自身通常出现在叫做Microsoft Visual Basic 5.0的子菜单上,尽管你的可能由于装置不同而有一些不同的权力。你将看到在Microsoft Visual Basic 5.0子菜单上列出的程序。当你从子菜单选择Visual Basic5.0asic加载并出现在你的屏幕上。

在大多数系统上,一旦你开始Visual Basic数字1.1的对话框出现。对话框让你启动VB应用程序精灵,编辑存在的VB程序或从你最近已经处理的程序列表上选取,取决于你点击的对话框制表符。

当你能看到对话框的底部,每次你开始当对话框的你能实际上是看,每次你开始Viaual Basic你不必看见对话框。在将来如果你点击选项标签,那么不显示选出这个对话框,当你开始Visual Basic时VisualBasic将不显示开的对话框。

数字1.1。当你开始VB时新工程对话框经常出现。

一旦你关上对话框,规则的可视化Basic屏幕出现。当数字1.2表演,VB打开的屏幕能开始工作!数字1.2表演Visual Basic开发环境,你将快变得密切地熟悉的环境。从这开发环境你将创建Windows程序。

数字1.2。Vb的屏幕看起来糊涂。

尽管屏幕看起来糊涂,你能充分定制适合你的需要和偏爱的Visual Basic屏幕将来,你将调整屏幕的窗户尺寸和皮肤并且显示某个窗户因此你的Visual Basic屏幕的开始状态可能与那数字1.2的非常地不一致。

停止Visual Basic

你将从Visual Basic退出并且回到Windowsde的方法与你退出大多数Windows应用程序的方法一样:选择文件|出口,点击Visual Basic的主窗口靠近的按钮,点击Alt+F4,或双击那出现在的屏幕左上角VB的控制菜单图标。

如果在当前开的工程以内你已经改变了一个或更多的文件(记得工程是包含你的应用程序文件的集合而成的),Visual Basic给你一个最后一个机会在退出Windows前保存你的工作。

掌握发展环境

word格式-可编辑-感谢下载支持

在你学习Visual Basic以前学习开发环境的细节是有点象在你学习开车以前学习一辆汽车的零件。然而,你花时间学习一些发展环境的更基本的原则,你将更好能学习Visual

Basic。在VB的环境以内你将更舒适并且当在发展环境随后涉及的窗口和工具时将更好的理解一些联系的词。

数字1.3说明了Visual Basic开发环境有许多更重要的屏幕成分的标记。你能从菜单和工具条发现,Visual Basic有点像市场上其它的Windows程序。按照在另外的应用程序他们做的许多Visual Basic的菜单条命令工作就像它们在其它应用程序,例如Microsoft Word,中做的一样。例如,你能选择编辑|剪切和编辑|粘贴来从一个地方剪切正文粘贴到另一个地方。今天,这些同样的菜单条命令几乎在市场上的每个其它的Windows程序上出现。

数字1.3。开始知道发展环境。

标准: 菜单条和工具条

Visual Basic的菜单条和工具条正如你期待它们的一样工作。你能点击或按一个菜单条选择的热键(例如, Alt+F显示文件菜单)可以看见提供命令的项的下菜单选择的列表,其它的水平菜单,或对话框。许多菜单选择有快捷键(经常被叫了的加速器钥匙)例如Ctrl+S为文件|保存选项。当你按一下快捷键时,你需要先显示菜单直接到存取选择。

工具条提供一个按钮存取许多普通的菜单命令。而不选择编辑|粘贴,例如,你能点击粘贴工具条按钮。就象今天大多数的Windows应用程序,Visual Basic支持大量工具条。选择视图|工具条看可得到的工具条的一张列表。每一个都普遍的以一个有名字的检查标记出现。

表格窗口:它会在哪出现

表格窗口是你主要的工作区域。尽管表格窗口起初相对于你的屏幕来说是很小,但是表格窗口包含你的应用程序的背景。换句话说,如果你用VB写一个基于Windows的计算器,那么这个计算器的按钮都会存在于表格窗口上,而且当某人运行这个计算器的时候,这个计算器就会只出现在表格窗口连带放置在那的组件和连接在那的代码。

提示:在表格窗口里你将不会看到程序的代码。表格窗口支持程序的交互式对象,例如命令按钮、标签、文本框、滚动条和其他的一些控制。这些代码在别处出现,这个特殊的窗口被称为代码窗口。这个代码窗口并没有在1.3节中出现,但是你可以通过选择视图/代码来看代码窗口。一个代码窗口要比一个文本编辑器小,文本编辑器就是你写连接程序的程序说明时所使用的工具。

考虑在1.4节窗口中运行的那个简单的程序。这个窗口显示一个简单的带有一系列选择的对话框、文本框和命令按钮。写这个程序的程序员是通过打开一个表格窗口,加入一些控制和连接一些组件来写的。那就是你将要做的不管是你写简单的还是复杂的VB应用程序。你将以一个空的表格窗口并向这个窗口添加控制例如选择和命令按钮开始。或许你的程序甚至需要多个表格窗口。

提示:一些程序,例如命令,允许在一个特殊的叫做MDI(multiple-document

interface)的模块中出现多个表格窗口,这里你可以在同一个程序中打开多个数据文档。只需要一个简单的数据窗口的程序称为一个SDI(single-document interface)程序,例word格式-可编辑-感谢下载支持

如Windows的记事本程序一次只允许用户打开一个数据文档。SDI程序可能支持多个表格;然而,这些表格不但支持多个数据文件而且还为额外的对话框和第二工作屏幕提供扩展的支持。

源程序是代码,表格,菜单,图表和你为形成一个工程而创建和编辑的帮助文件(也称为源代码)。

部分你创建的程序,例如表格,代码和你为输出准备的图形,包括源程序。当你或者其他的用户连接或运行这个源程序,VB将程序翻译成一个可执行的程序。你不能对一个可执行程序进行一个直接的修改。如果你在运行程序的过程中发现一些小错误,你必须修改源程序(在这个工程中包含多个文件)并再运行和再编译这个源程序。

工具箱提供控制

工具箱包括你放置在表格窗口中的命令。你将在下一节课的时间学习到如何在表格窗口里放置工具箱命令。工具箱有用不完的命令;如果你在表格窗口中放置一个命令按钮,那么你也要在工具箱中放置同样的按钮。这些被称为固有命令因为VB的三个版本都支持这些标准的工具。你可以根据你的需要加一些额外的控制到工具箱中。一些额外的工具在VB的三个版本中,但是这些额外的工具并不出现在工具箱窗口中,除非你通过工程/组件菜单选择中加入它们。如果你使用专业或者企业版本,你将能够加一些在标准版本中并不出现的额外的控制。

表格设计窗口放置表格

表格设计窗口展现最初的位置和在表格窗口显示出来的正确的表格的相关的大小。已经学习过的程序是一个多重表格程序。带有文本框题目的表格只是若干表格中的一个。表格设计窗口总是显示在当前的表格窗口中表格在哪出现。如果你想让某个表格在当前位置的不同地方出现的话,那么你可以在表格设计窗口内将表格移动到表格出现的位置当用户运行这个程序时。

提示:注意表格位置指示器,在工具栏按钮的右边,当你在表格设计窗口移动表格时,它的位置将会改变。

工程资源管理器窗口

工程资源管理器窗口,经常被称为工程窗口,为你提供在应用程序中所有文件的树状结构。微软在版本4和版本5之间的版本中将名字从工程窗口改为工程资源管理器窗口,用来庆祝在Windows 95和NT中普遍的树状型文件和典型资源管理器之间的类同。你可以扩展和结合观点的分支以获得多多少少的描述。

道具窗口

道具是被一个命令的描述性信息详述的。

每次当你点击一个不同的表格窗口工具时,一个不同的列表将会在道具窗口中显示出来。道具窗口描述关于某一形式命令的特性(描述性的和功能性的信息)。在VB中很多特性基本上存在每一个对象中。 word格式-可编辑-感谢下载支持

帮助在你指尖中

在线图书就是关于VB的电子图书适合VB程序员。

VB的在线帮助系统是市场上最先进的系统之一。当你需要帮助做一个控制,窗口,工具,或者命令时,请按F1。VB分析你所做的并提供帮助。除此之外,VB还提供一个巨大的帮助资源叫做在线图书。当你在帮助菜单中选择了在线图书时,VB会展示关于VB的一系列树状结构形式的书,这样你就能找到你所需要的书籍并阅读。这个在线帮助也扩展到Internet上。如果你可以连接到Internet,那么你就可以通过选择在线帮助/微软浏览到最新的帮助主题。

总结

这段时间快速的带你熟悉VB。你或许已经比开始时更明白VB了。程序员用VB开发非常先进的Windows应用程序。现在你明白了VB的用途和怎样去打开、关闭VB,你准备好全心的投入到VB的学习中。

附件2:外文原文(复印件)

Whats Visual Basic About?

Controls are tools on the Toolbox window that you place on a form to interact

with the user and control the program flow.

Microsoft Visual Basic 5.0, the latest and greatest incarnation of the old

BASIC language, gives you a complete Windows application development system in word格式-可编辑-感谢下载支持

one package. Visual Basic (or VB, as we often call it) lets you write, edit, and

test Windows applications. In addition, VB includes tools you can use to write

and compile help files, ActiveX controls, and even Internet applications.

Visual Basic is itself a Windows application. You load and execute the VB system

just as you do other Windows programs. You will use this running VB program to

create other programs. VB is just a tool, albeit an extremely powerful tool, that

programmers (people who write programs) use to write, test, and run Windows

applications.

Although programmers often use the terms program and application

interchangeably (as will be done throughout this 24-hour course), the term

application seems to fit the best when you're describing a Windows program because

a Windows program typically consists of several files. These files work together

in the form of a project. The project generates the final program that the user

loads and runs from Windows by double-clicking an icon or by starting the

application with the Windows Start menu.

The role of programming tools has evolved over the past 45 years along with

computer hardware. A programming language today, such as Visual Basic, differs

greatly from programming languages of just a few years ago. The visual nature of

the Windows operating system requires more advanced tools than were available a

few years ago. Before windowed environments, a programming language was a simple

text-based tool with which you wrote programs. Today you need much more than just

a language; you need a graphical development tool that can work inside the Windows

system and create applications that take advantage of all the graphical, multimedia,

online, and multiprocessed activities that Windows offers. Visual Basic is such

a tool. More than a language, Visual Basic lets you generate applications that

interact with every aspect of today's Windows operating systems.

If you've taken a look at Visual Basic in the past, you'll be amazed at today's

Visual Basic system. VB now sports a true compiler that creates standalone

runtime

.EXE files that execute more quickly than previous VB programs. VB also

includes several wizards that offer step-by-step dialog box questions that guide

you through the creation of applications. VB's development platform, a development

environment called the Developer Studio, now supports the same features as the

advanced Visual C++ and Visual J++ compilers. Therefore, once you learn one of

Microsoft's Visual programming products, you will have the skills to use the other

language products without a long learning curve ahead of you.

Languages

Programming languages today are not what they used to be. The language itself

has not gotten less important; rather, the graphical interfaces to applications

have gotten more important.

A computer cannot understand any person's spoken language. A spoken language,

such as Italian or English, is simply too general and ambiguous for computers to

understand. Therefore, we must adapt to the machine and learn a language that the

computer can understand. VB's programming language is fairly simple and uses common

English words and phrases for the most part. The language is not ambiguous, however.

When you write a statement in the Visual Basic language, the statement never has

multiple meanings within the same context. word格式-可编辑-感谢下载支持

As you progress through the next 24 hours, you will learn more and more of

the Visual Basic language's vocabulary and syntax (grammar, punctuation, and

spelling rules). You will use the VB programming language to embed instructions

within applications you create. All the code you write (code is the program's

instructions) must work together to instruct the computer. Code is the glue that

ties all the graphics, text, and processes together within an application. Code

tells a checkbook application, for example, how to be a checkbook application and

not something else. The program code lets the application know what to do given

a wide variety of possible outcomes and user actions.

The VB Programming Process

When you want to use Visual Basic, you'll follow these basic steps:

1. Start Visual Basic.

2. Create a new application or load an existing application. When you create

a new application, you might want to use Visual Basic's VB Application Wizard

to write your program's initial shell, as you'll do in the next hour.

3. Test your application with the debugging tools Visual Basic supplies.

The debugging tools help you locate and eliminate program errors (called

bugs) that can appear despite your best efforts to keep them out.

4. Compile your program into a final application.

5. Quit Visual Basic.

6. Distribute the application to your users.

Rarely will you perform all these steps sequentially in one sitting. The six

steps are not sequential steps, but stages that you go through and return to before

completing your application.

Starting Visual Basic

You start Visual Basic from the Windows Start menu. The Visual Basic

development environment itself usually appears on a submenu called Microsoft

Visual Basic 5.0, although yours might be called something different due to

installation differences. You will see additional programs listed on the Microsoft

Visual Basic 5.0 submenu, but when you select Visual Basic 5.0 from the submenu,

Visual Basic loads and appears on your screen.

On most systems, Figure 1.1's dialog box appears as soon as you start Visual

Basic. The dialog box lets you start the VB Application Wizard, edit an existing

VB project, or select from a list of recent projects you've worked on, depending

on the dialog box tab you click.

As you can see at the bottom of the dialog box, you don't have to see the dialog

box every time you start Visual Basic. If you click the option labeled Don't show

this dialog box in the future, Visual Basic will not display the opening dialog

box when you start Visual Basic.

Figure 1.1. The New Project dialog box often appears when you start VB.

Once you close the dialog box, the regular Visual Basic screen appears. As

Figure 1.2 shows, VB's opening screen can get busy! Figure 1.2 shows the Visual

Basic development environment, the environment with which you will become word格式-可编辑-感谢下载支持

intimately familiar soon. From this development environment you will create

Windows programs.

Figure 1.2.

VB's screen looks confusing at first.

Although the screen can look confusing, you can fully customize the Visual

Basic screen to suit your needs and preferences. Over time, you will adjust the

screen's window sizes and hide and display certain windows so that your Visual

Basic screen's start-up state might differ tremendously from that of Figure 1.2.

Stopping Visual Basic

You'll exit from Visual Basic and return to Windows the same way you exit most

Windows applications: Select File|Exit, click Visual Basic's main window close

button, press Alt+F4, or double-click VB's Control menu icon that appears in the

upper-left corner of the screen.

If you have made changes to one or more files within the currently open project

(remember that a project is the collection of files that comprise your application),

Visual Basic gives you one last chance to save your work before quitting to Windows.

Mastering the Development Environment

Learning the ins and outs of the development environment before you learn

Visual Basic is somewhat like learning the parts of an automobile before you learn

to drive. If, however, you take the time to learn some of the development

environment's more fundamental principles, you will be better able to learn Visual

Basic. You then will be more comfortable within VB's environment and will have

a better understanding of the related words when subsequent lessons refer to the

windows and tools in the development environment.

Figure 1.3 shows the Visual Basic development environment with many of the

more important screen components labeled. As you can see from the menu and toolbar,

Visual Basic looks somewhat like other Windows programs on the market. Many of

Visual Basic's menu bar commands work just as they do in other applications such

as Microsoft Word. For example, you can select Edit|Cut and Edit|Paste to cut and

paste text from one location to another. These same menu bar commands appear on

almost every other Windows program on the market today.

Figure 1.3. Getting to know the development environment.

Standards: The Menu Bar and Toolbar

Visual Basic's menu bar and toolbars work just as you expect them to. You can

click or press a menu bar option's hotkey (for example, Alt+F displays the File

menu) to see a pull-down list of menu options that provides either commands, another

level of menus, or dialog boxes. Many of the menu options have shortcut keys (often

called accelerator keys) such as Ctrl+S for the File|Save option. When you press

an accelerator key, you don't first have to display the menu to access the option.

The toolbar provides one-button access to many common menu commands. Instead

of selecting Edit|Paste, for example, you could click the Paste toolbar button.

As with most of today's Windows applications, Visual Basic supports a wide range word格式-可编辑-感谢下载支持

of toolbars. Select View|Toolbars to see a list of available toolbars. Each one

that is currently showing will appear with a checkmark by its name.

The Form Window: Where It All Happens

The Form window is your primary work area. Although the Form window first

appears small relative to the rest of your screen, the Form window comprises the

background of your application. In other words, if you write a Windows-based

calculator with Visual Basic, the calculator's buttons all reside on the Form

window and when someone runs the calculator, the calculator that appears is really

just the application's Form window with components placed there and tied together

with code.

NOTE:You will not see program code on the Form window. The Form window

holds the program's interactive objects, such as command buttons,

labels, text boxes, scrollbars, and other controls. The code appears

elsewhere in a special window called the Code window. The Code window

does not appear in Figure 1.3, but you can select View|Code to see

the Code window. A Code window is little more than a text editor with

which you write the programming statements that tie together the

application.

Consider the sample program running in Figure 1.4's window. The window shows

a simple dialog box with a few options, text boxes, and command

programmer who created Figure 1.4's dialog box did so by opening a Form window,

adding some controls (the items on the Form window that interact with the

user--sometimes called tools), and tying the components together with some Visual

Basic language code. That's exactly what you will do when writing simple and complex

Visual Basic applications. You will begin with a blank Form window and add controls

to the Form window such as options and command buttons. Perhaps your application

might even require multiple Form windows.

NOTE: Some applications, such as Word, allow for several Form windows

in a special mode called MDI (multiple-document interface) in which

you can open multiple data documents within the same application. An

application that requires only a single data window is called an SDI

(single-document interface) application, such as the Windows Notepad

application that lets the user open only one data document at a time.

SDI applications might support multiple forms; however, these forms

do not hold multiple data files but only provide extended support for

extra dialog boxes and secondary work screens.

Source program is code, forms, menus, graphics, and help files that you create

and edit to form the project (also called source code).

The parts of the application that you create, such as the forms, the code,

and the graphics that you prepare for output, comprise the source program. When

you or another user compiles or runs the source program, VB translates the program word格式-可编辑-感谢下载支持

into an executable program. You cannot make changes directly to an executable

program. If you see bugs when you run the program, you must change the source

application (which might contain multiple files in the project) and rerun or

recompile the source.

The Toolbox Supplies Controls

The toolbox contains the controls that you place on the Form window. You will

learn in the next hour's lesson how to place toolbox controls on the Form window.

The toolbox never runs out of controls; if you place a command button on the Form

window, another awaits you on the toolbox, ready to be placed are called

the intrinsic controls because all three editions of VB support these standard

tools. You can add additional controls to the toolbox as your needs grow. Some

extra tools come with all three editions of VB, but these extra tools do not appear

on the Toolbox window until you add them through the Project|Components menu option.

If you use the Professional or Enterprise Editions, you will be able to add extra

controls that don't appear in the Standard Edition's collection of intrinsic and

extra controls.

The Form Layout Window Places Forms

The Form Layout window displays the initial position and relative size of the

current form shown in the Form application being studied is a

multiple-form application. The form with the title Text Box Properties is just

one of several forms. The Form Layout window always shows where the form appears

in the current Form window. If you want the form to appear at a different location

from the current position, you can move the form inside the Form Layout window

to move the form's appearing position when the user runs the application.

TIP: Notice that the form location indicators, to the right of the

toolbar buttons, change when you move the form in the Form Layout

window.

The Project Explorer Window

The Project Explorer window, often called the Project window, gives you a

tree-structured view of all the files in the application. Microsoft changed the

formal name from Project window to Project Explorer window between versions 4 and

5 to celebrate the resemblance of the window to the typical Explorer-like

tree-structured file views so prevalent in Windows 95 and NT. You can expand and

collapse branches of the view to get more or less detail.

The Properties Window

Properties are detailed descriptive information about a control. A different

list appears in the Properties window every time you click over a different Form word格式-可编辑-感谢下载支持

window tool. The Properties window describes properties (descriptive and

functional information) about the form and its controls. Many properties exist

for almost every object in Visual Basic.

Help Is at Your Fingertips

Books Online are electronic books about Visual Basic for the Visual Basic

programmer. Visual Basic's online help system is one of the most advanced on the

market. When you want help with a control, window, tool, or command, press F1.

Visual Basic analyzes what you are doing and offers help. In addition, Visual Basic

supports a tremendous help resource called Books Online. When you select Books

Online from the Help menu, Visual Basic displays a tree-structured view of books

about Visual Basic that you can search and read. The online help extends to the

Internet as well. If you have an Internet connection, you can browse the latest

help topics by selecting Help|Microsoft on the Web.

Summary

This hour quickly introduced you to Visual Basic. Perhaps you already can see

that Visual Basic is more than it first appears. Programmers use Visual Basic to

create extremely advanced Windows applications. Now that you understand VB's

purpose and how to start and stop VB, you're ready to jump right in.

本文标签: 程序表格应用程序菜单命令