How to get started with vb language programming

What to learn before programming

To be a good programmer, the most important thing is to master programming ideas and find a sense of programming, rather than memorizing the language itself. So, from a certain perspective, many languages ​​are consistent. Learned C++, JAVA can also get started quickly. When we face a new programming language, we can easily respond to and apply it by simply understanding the grammatical features of the language. The high-level realm of a programmer is subtly accumulating in repeated practice, observation, analysis, comparison, and summarization. It is not an article or two or three hours of explanation.

To learn programming ideas and find programming sensations, we must practice and experience from the actual practical work of programming. Many friends only learn grammar and structure when learning programming, which is boring and not very purposeful, which will greatly reduce the interest and learning effect of beginners. The general books only explain the grammar from the language itself and give some application examples for these grammars. It is not much different from the instruction manual, and does not play the role of instilling programming ideas and cultivating programming feelings. Because of this, many college students have studied C in school, but few of them are really proficient in C language programmers. They simply understand some grammars, and many important knowledge points are ambiguous.

This article mainly introduces how to get started with vb language programming, and learn about them in detail.

How to get started with vb language programming

How to get started with vb language programming

VB6.0 is called VisualBasic 6.0. It is one of the visual programming tools MSDN launched by Microsoft. It is the most widely used program development tool in the world.

If you are a beginner who knows nothing about programming and is eager to master a fast and practical programming language, then choosing VB 6.0 is not wrong. Even considering the inefficiency of the VB program itself compiling and running less efficiently (嘻嘻 speed is not a problem now), its fast development speed, easy to learn syntax, considerate and convenient development environment, it still does not lose a Excellent programming tools are the first choice for beginners.

First, the VisualBasic 6.0 environment to build

1, download VisualBasic 6.0 development integration environment, do not download the lite version, can not download the Baidu message to me, and then extract the installation can

2, the installation is complete, open as shown

How to get started with vb language programming

Second, VB integrated development environment

1, the title bar

The title bar is at the top of the main window, as shown in Figure 1.1. In addition to displaying the name of the project being developed or debugged, the title bar is also used to display the working status of the system. In VB, the process used to create an application is called "design state" or "design-time"; the process of running an application is called "running state" or "runtime" (Run) -time). When an application is debugged (that is, commissioned) in a VB environment for some reason its operation is temporarily terminated, it is called "Break-time". The leftmost part of the title bar is the control menu box, which is used to control the size, movement, restoration, maximization, minimization and closing of the main window. Double-click this box to exit the VB integrated development environment.

How to get started with vb language programming

2, the menu bar

The menu bar is located below the title bar, as shown in Figure 1.1. In addition to the standard "File", "Edit", "View", "Window" and "Help" menus, VB's menu bar also provides programming-specific function menus such as "Engineering", "Format", " Debug, Run, Query, Chart, Tools, and Add-ins.

3, the toolbar

The toolbar is usually located below the menu bar, as shown in Figure 1.1. VB's toolbar includes four sets of toolbars: Standard, Edit, Form Editor, and Debug. Each toolbar consists of several command buttons that provide quick access to frequently used commands in a programming environment. Only the "Standard" toolbar is displayed after starting VB without the corresponding settings. The "Edit", "Form Editor" and "Debug" toolbars can be displayed by selecting the corresponding toolbar name in the "Toolbar" command of the "View" menu when needed, or by right mouse button. Click on the blank portion of the Standard toolbar and select the desired toolbar name from the pop-up menu that opens.

4, control toolbox

The control toolbox, also known as the toolbox, is located at the bottom left of the main VB window, as shown in Figure 1.1. It provides common tools (controls) that software developers need to use when designing an application interface. These controls are stored in the toolbox as icons, and when the software developer designs the application, they use these controls to "draw" the application's interface on the form. The icons and names in the commonly used controls in the toolbox are shown in Figure 1.2.

Toolbox In addition to the most commonly used controls, new controls can be added to the toolbox depending on the needs of the design program interface. Adding new controls can be done by selecting the "Parts" command in the "Project" menu or by right-clicking in the toolbox. Mouse, select the "Parts" command in the pop-up menu to complete

How to get started with vb language programming

5, the form designer

The form designer is located in the middle of the VB main window, as shown in Figure 1.1. It is a custom window for designing the application interface. Each form in the application has its own form designer. The form designer always appears with the form in between, and when the VB starts to create a new project, the form designer appears along with the initial form "Form1" in between. To add another form to your application, click the Add Form button on the toolbar.

6, the property settings window

The property settings window is located to the right of the form designer, as shown in Figure 1.1 and Figure 1.3. It is mainly used to set initial property values ​​for each object on the selected form and form when designing the interface. It consists of a title bar, an "Object" list box, an "Properties" list box, and a description of the properties. The title of the property settings window is labeled with the name of the form. Use the mouse to click the button on the right side of the "Object" list box under the title bar to open its drop-down list box, from which you can select each object in the form. After the object is selected, the following property list box is listed. The individual properties associated with the object and their settings. The Properties window has two tabs, Alphabetical and Sort by, which arrange the attributes alphabetically or in sorted order. When an attribute is selected, a description of the attribute is given in the description box below.

How to get started with vb language programming

7, the code editor

Developing applications with VB involves two parts: one is to design a graphical user interface; the other is to write program code. Designing the graphical user interface is done through the form designer; the purpose of the code editor is to write the application code. When designing a program, when you double-click a form in the form designer or an object on the form with the mouse, the code editor will appear in the VB integration environment, as shown in Figure 1.4. There is a separate code editor for each form and standard module of the application. There are two list boxes in the code editor, one for the Object list box and one for the Events list box. It is very convenient to write an event procedure for an object by selecting the object to be coded from the list box (or "general" if it is a common code segment) and then selecting the corresponding event.

How to get started with vb language programming

8, engineering resource manager

The Project Explorer, also known as the Project Explorer, is located at the top right of the Form Designer, as shown in Figure 1.1 and Figure 1.5. It lists a list of all the files included in the current application. A VB application, also known as a project, consists of a project file (.vbp) and several form files (.frm), standard module files (.bas), and class module files (.cis). There is a small toolbar on the Project Explorer window with the three buttons above for viewing code, viewing objects, and switching folders. Select the object in the Project Explorer window and click the View Object button to display the form object you want to view in the Form Designer. Click the View Code button and the object will appear. Code Editor window.

How to get started with vb language programming

9, the form layout window

The form layout window is located at the bottom right of the form designer, as shown in Figure 1.1 and Figure 1.6. At the time of design, right click on the form icon in the small image of the screen, a menu will pop up, and the relevant command item in the menu can be selected to set the position of the form on the screen when the program is running.

How to get started with vb language programming

Third, the programming steps

1, create a program interface

The program interface is a bridge between the program and the user. It is usually composed of various buttons, text boxes, menu bars, and toolbars in the window and window. The creation of the program interface is actually based on the function requirements of the program and the form and content of the information transmitted between the program and the user, and the working mode of the program, etc., determining the size and position of the window, which objects to include in the window, and then using the form. The designer draws and places the desired control object.

2, set the properties of the object

In the process of creating the program interface, you should set the corresponding properties for both the form and the objects on the form as needed. The settings of the property can be set either through the property window at design time or through the program code, while the program is running.

3, write the program code

The interface only determines the appearance of the program. After the program receives the necessary information through the object on the interface, how to do it, what kind of operation to do, how to respond to the information input by the user through the interface, what information to process, and also need to write the corresponding program code. achieve. Write the program code through the code editor.

4, save the project

Once a VB project (program) has been created, it can be saved using the Save Project command in the File menu or the Save Project button on the toolbar. When you save for the first time, you should save all the files in turn according to the system prompts. It is best to keep all the files in a project in the same separate folder, which is beneficial for management and use.

5, test and debug the application

Testing and debugging procedures are necessary steps to ensure that the developed program implements the intended functionality and makes it work correctly and reliably.

6, create an executable program

Creating an executable program is to compile the project into an executable program (.exe file) that can be run independently from the VB environment and directly in the Windows environment.

How to get started with vb language programming

Fourth, VB project management

1 Introduction

In VB, creating an application is called building a project. A VB project consists of several different types of files, and a project is a collection of these files. A VB project usually contains a project file (.vbp) and several form files (.frm) (at least one form file), and sometimes other types of files, such as standard module files (.bas). Class module files (.cis), resource files (.res), custom control files (.ocx), and user documentation (.dob or .dox). For the convenience of use and management, when saving a project, it is recommended to save the relevant files in the project in a separate folder.

2, project documents

When creating a VB project, the system will create a project file with the extension ".vbp". The purpose of the project file is to record information about all the files that were created when the project was created. It should be noted that the project file contains relevant information when other files are created, but does not contain the details of other files, so it does not represent the entire project. Since the project file records information about all the files in the project, for an established project, when you open the project file in the project, all other files in the project will be opened at the same time. For a newly created project, when the project is saved for the first time, the system will promptly save all the files one by one, and for an established project, if it is opened again for modification, as long as the save project command is executed, all file modifications can be saved. Instead of having to save them one by one.

3, the form file

The form file is also called the form module file. Since the form is an indispensable object when creating the VB application interface, the form and form files are the most important objects and files in VB. A VB project must contain at least A form can contain up to 255 forms, each with a corresponding form file. The form file contains not only event procedures for handling the various objects that occur in the form, but also the property settings and descriptions of the objects in the form and the form. The form file can be summarized as: form file = form interface + form program code.

4. Other documents

The function of the standard module file is mainly to organize the program code segments (general processes) that can be shared by multiple modules in the application. For global variables that can be shared by multiple modules, it is usually defined in the standard module. Unlike the form module, the standard module has only program code and no corresponding interface. A VB project can contain multiple standard module files as needed, or not. Class module files are mainly used to create new classes and specify the properties and methods of the class. Similar to standard module files, class module files are also optional in a VB project.

Hat Camera

Micro camera is the product of modern high-tech, also known as micro monitor, which has the characteristics of small size, powerful function and good concealment.

Micro cameras are widely used, suitable for aviation, commerce, media, enterprises and institutions, families and other industries. The emergence of miniature cameras brings convenience to people's lives, and at t,he same time, some phenomena related to corporate secrets and personal privacy also arise.

Hat Camera, widely used Camera,small size Camera

Jingjiang Gisen Technology Co.,Ltd , https://www.gisentech.com

Posted on