Programming in BASIC for dummies. Visual basic programming language

The goal of modern secondary education is to develop key competencies in students. Key competencies include one of the most important skills - the ability to live in information world. For social adaptation and professional self-determination, modern schoolchildren need skills in using a personal computer, various programming languages, and the ability to create projects in various programming environments.

This program has the following goals:

1.Give students an idea of ​​the Visual Basic programming language.

2. Familiarize yourself with the constituent elements of the Visual Basic programming environment.

3.Give skills for creating projects in this programming environment.

This program meets the challenges of modern school education, performing educational, educational and developmental tasks.

The main educational objectives of this project:

  • Learn the Visual Basic programming language.
  • Train students to work in the Visual Basic programming environment;
  • Provide basic skills for creating projects in this programming environment;

Basic educational tasks project:

  • To cultivate in schoolchildren personal qualities that contribute to successful social adaptation: determination, objectivity in self-esteem, responsibility, cognitive interest.

Main development tasks of the project:

  • To develop in students key competencies that contribute to successful social adaptation;
  • Develop a desire for self-development and personal growth through cognitive activity.

The Visual Basic learning program is based on a consistent and logical lesson system. The system of lessons for learning the Visual Basic programming language includes six lessons, each of which has its own goals and objectives and gradually solves the main problem: teaching a new Visual Basic programming language.

Lesson #1. Topic: Visual Basic programming language. Download Visual Basic 6.0. Familiarity with the constituent elements of this programming environment. Review and analysis of the proposed project.

Lesson #2. Topic: Visual Basic programming language. Creating a simple project in Visual Basic.

Lesson #3. Topic: Visual Basic programming language. Creating projects in this programming environment.

Lesson #4. Topic: Visual Basic programming language. Create a project to perform calculations together with a teacher, and then work independently to create the project.

Lesson #5. Topic: Visual Basic programming language. Working with user procedures and functions.

Lesson #6. Topic: Visual Basic programming language. Working with arrays.

This system of lessons uses various forms of training (individual, group), various teaching methods (theoretical, practical, project), various forms of work (lecture, independent work educational nature with subsequent self-test, frontal survey, creation of a project).

This lesson system is offered for testing in the 11th grade of a secondary school, provided there is a computer science classroom with personal computers and the Microsoft Visual tool system Studio Visual Basic 6.0.

Before you start programming, you need to learn how to use the environment of the language proposed for learning. And since it is in Russian, this will not be difficult. | So, we have to find out: | where to get Russian BASIC; | how to launch it and get started;

  • How to enter program text in the editor window

    The cursor blinks in the editor window - a horizontal luminous line indicating where the program text will be entered when typing it from the keyboard. | If you notice that you have typed something incorrectly, there are several ways to correct your mistakes. | Removing extra characters.

  • Launching the program for execution. Saving and opening files in BASIC.

    How to launch the program? When you have written a program and want to see what actually came out of it, you need to press the F5 key. The program will be executed if there is no syntax errors, and then you will see the results of its operation and a message at the bottom of the screen “To continue, press any key.”

  • Alphabet of the language. A variable and what changes in it.

    In any textbook foreign language First, its alphabet is given, i.e., a set of symbols for writing words, sentences and all kinds of concepts of this language. The BASIC language also has an alphabet that contains the following characters:

  • Arithmetic in BASIC

    Before moving on (“How difficult it is to move on” - from a song by Boris Grebenshchikov), it is necessary to recall that in those distant times, when algorithmic languages ​​were just emerging, and the phrase " Personal Computer"caused those who heard it to doubt the sanity of the one who pronounced it, and so, in those very times it was believed that a computer (from the English compute - calculate), i.e.

  • Assignment operator. Assignment operator syntax.

    Imagine that you have developed an algorithm, thought about what variables will be involved in it, come up with names for them, and what next? How do you tell the computer their meanings? How to change these values? So, we are introduced to the first operator of the BASIC language - the assignment operator.

  • We display the results

    So far we have been inputting raw data into the computer using the assignment operator. Other input methods will be discussed in one of the following chapters. | Now I would like to consider a component of BASIC that is more important at first - the output of the results obtained on the monitor screen, as well as output of all kinds text messages. That is, we are introduced to the powerful print operator.

  • Standard BASIC functions

    Before we forget elementary arithmetic in BASIC and outputting results (I hope you can do this, and in a complete manner, beautiful shape with tips), you need to familiarize yourself with standard features BASIC language to fully experience its computing capabilities.

  • Display data at a specified location on the screen

    Computer screen in text mode is a conditional grid of columns and rows. IN standard mode There are 80 such columns (i.e., no more than 80 characters can fit in a line), and 25 rows. | BASIC has an operator that allows you to control the display of data on the screen, which significantly improves the user's perception of programs.

  • Enter the data. INPUT statement.

    What's good about BASIC? Because it allows you to write programs that are very friendly to the user, asking him for parameters that are unique to him and solving the task for very specific data quite specific person or any other object.

  • DATA and READ statements

    There is another way to enter data. It is used if this data is known in advance. Then we organize some kind of warehouse in the program (using the data operator), and then using read operator We sequentially read this data into the requested variables, in which they are stored and processed.

  • In 1964, the BASIC language was born. It was developed for educational purposes, so that university students could learn programming using simple algorithms. BASIC became a real breakthrough in education, and in real life programmers competed to create dialects. Among the geeks fascinated by the language was Bill Gates. At the age of 13, he wrote his first program on it, and at 20, he made money by implementing a version of Altair BASIC, which he developed together with Paul Allen.

    In the 80s, the popularity of BASIC began to decline. New programming languages ​​have gotten rid of complex syntax, while their capabilities have increased. And only Microsoft continued to stick to its line, releasing first another bestseller QBasic, and then the hero of today's text - Visual Basic.

    Brief information

    First Visual versions Basic was not successful among developers. Graphical interface, and then syntax highlighting were almost the only difference from QBasic. Microsoft started make significant changes only from version 3.0. In the Professional package, developers were able to work with the database Access data, graphic capabilities allowed even non-programmers to work with the language. In addition, performance has increased and software installation has been simplified.

    In 1995, Windows 95 was released, along with which Visual Basic 4.0 set off to seize world domination. A full-fledged compiler appeared here, the ability to create 32 and 16-bit applications, and the speed of operation increased. Released in 1998 latest version traditional Visual Basic. Next, Microsoft changed the concept, launching the development of the language in two directions: VB on the .NET platform and adapted versions for solving local problems (VBA, VBScript, eVB).

    Visual Basic today

    VB is a tool for quick creation Windows applications. After changing the concept, the language acquired:

    • OOP support with constructors, destructors and inheritance;
    • free multithreading;
    • compilation into bytecode executed using the CLR;
    • structured exception handling;

    But the main convenience is the .NET platform. This means that developers now have access to a huge number platform libraries for working with databases, graphics, forms, security and the web.

    Another popular successor is Visual Basic for Applications (VBA). This is a stripped-down VB 6.0 for processing macros, creating scripts, which simplifies work within the OS.

    In AutoCAD, CorelDraw, SolidWorks and, of course, Microsoft Office you can export data, structure information, connect a database. Even at the everyday level, you will need the ability to create auto-filled forms and extract information in one click from Excel. For work that doesn't necessarily involve programming, VBA makes it easier to create technical documents, drawings, and plans.

    Literature

    It is better to start learning the language with VBA. Firstly, it is simpler, secondly, the target products are well known to you, and thirdly, the restrictions will allow you to concentrate on the language. It is believed that for learning VBA you will need 30 hours. In fact, no more than 15. You can use one of the following books as a basis:

    • Excel 2013. Professional VBA Programming, John Walkenbach.
    • Solving scientific and engineering problems using Excel, VBA and C C++, Igor Gaidyshev.
    • VBA for Dummies, Steve Cummings.
    • VBA tutorial, Andrey Garnaev.
    • Access. Programming in VBA, a selection of articles.

    Programming in Visual Basic .NET is more difficult, but also more interesting. Time and reference resources more will be needed.

    Visual Basic.net for Dummies - Wallace Wong - 2002.

    Welcome to the world computer programming using Visual Basic.
    NET - developed by Microsoft programming language that will help
    it's easy and quick for you to write own programs. If you have long been excited about the idea of ​​creating
    your programs, but at the same time you are afraid that you are not up to it, cast aside your doubts
    away. If you are able to write a short step by step instructions on how to get to
    your home, which means you can master the process of writing programs in Visual language Basic.
    NET. To help you learn the basics of Visual Basic programming. NET.
    The material in this book is presented in a simple manner, accessible language, and the main emphasis is on those
    functionality that will surely be useful to you when writing
    own software products.
    The book is intended for beginners.

    Table of contents
    Introduction 19
    Chapter 1. How Visual Basic .NET Works 25
    Chapter 2: Visual Basic .NET Application User Interface 31
    Chapter 3. Creating a user interface 39
    Chapter 4. Let's start writing BASIC codes 47
    Chapter 5. Creation user interface: let's look into the details 61
    Chapter 6. Designing Forms 79
    Chapter 7. Elements as a Means of Providing User Choices 91
    Chapter 8: Using Text Boxes and Labels 97
    Chapter 9: Using Lists and Combo Boxes 105
    Chapter 10: Customizing the User Interface Display 113
    Chapter 11: Designing Drop-Down Menus 121
    Chapter 12. Submenus, expandable menus, and drop-down menus 131
    Chapter 13. Dialog boxes 139
    Chapter 14. Writing Event Procedures 155
    Chapter 15: Using Variables 167
    Chapter 16. Receiving data from the user 177
    Chapter 17. Let's do mathematics 183
    Chapter 18. Processing text information 195
    Chapter 19: Defining Constants and Using Comments 205
    Chapter 20: Creating Data Structures 213
    Chapter 21. Fighting errors 223
    Chapter 22. Conditional statements If-Then 235
    Chapter 23: Select Case Operator 243
    Chapter 24: Creating Loops 249
    Chapter 25. Cycles that can count 255
    Chapter 26 Nested Loops 261
    Chapter 27. General procedures 267
    Chapter 28: Using Arguments 275
    Chapter 29: Creating Functions 281
    Chapter 30. So what is object-oriented programming? 291
    Chapter 31: Object-Oriented Programming in Practice 297
    Chapter 32. Inheritance and Overloading 305
    Chapter 33. Ten the most useful tips that you are unlikely to find
    somewhere else 315
    Chapter 34: Tips for Using the Visual Basic .NET Interface 321
    Subject index 325

    Free download e-book V convenient format, watch and read:
    Download the book Visual Basic.net for Dummies - Wallace Wong - fileskachat.com, fast and free download.

    Download pdf
    You can buy this book below best price at a discount with delivery throughout Russia.

    Programming system this is the package software, which, in addition to the translator, also includes an editor for entering code, tools for automating the creation and debugging of programs, libraries with ready-made blocks code, a convenient reference book and other special tools.

    There is a programming system for the BASIC programming language Microsoft Visual Basic – VB for short. For the Pascal programming language - Borland Delphi. For the SI++ programming language, these are Microsoft Visual C++ and Borland C++ Builder. From any Microsoft applications Office in the Windows operating environment, you can run the Visual Basic for Applications (VBA) programming system in short.

    The listed programming systems are visual programming systems, that is, objects in this system are created using the mouse.

    Windows OS has a lot of standard elements: windows, menus, buttons, etc. For them, the system has prepared standard blocks machine code - they are stored in dynamic libraries - files with the extension .DLL. Therefore, a Windows program no longer looks like a set of sequential commands, but like countless calls to procedures stored in Windows. Considering the above, for programming in the environment operating system Windows requires purchasing system programming programs.

    Visual Basic is universal language programming for beginners. Microsoft Visual Basic is a software development tool developed by Microsoft Corporation and includes a programming language and development environment.

    The program in which new programs are created is called the Visual Basic programming environment. Since this environment runs on a computer along with the Windows operating environment, you will create programs called Windows applications or simply: applications. To create an application, you need to create a project. This is what you will do in the Visual Basic programming environment.

    Advantages of Visual Basic

      Visual Basic compares favorably with other programming languages ​​due to its simplicity and clarity.

      Visual Basic is a dynamically developing language.

      Visual Basic is built into programs such as Word, Excel, etc. It can be used to control these programs from other programs.

      Visual Basic is an object-oriented language. The basis of the language is objects. For example: a window, a button, a combo box with which the program works.

    Basics of programming in visual basic

    When you start the visual programming system (in this system, objects are created using the mouse), you will have access to: a window of standard object classes; properties window for these objects; code window.

    STANDARD OBJECT CLASSES, for example, such as WINDOWS (a window is called a FORM) and CONTROLS (buttons, lists, fields, radio buttons, check boxes, command buttons and others), are presented in the visual programming system as icons on the toolbar.

    Using the mouse, the programmer drags control elements from the ToolBox toolbar onto the FORM.

    Next, the programmer uses the mouse to call up the OBJECT PROPERTIES window and configures the properties of each object (selects with the mouse from the OBJECT PROPERTIES window), for example, such as: name, size, color characteristics, position on the form and on the screen, font, labels on objects, and so on.

    Now these objects, with the properties we have specified, need to be assigned a certain EVENT PROCEDURE (or they say - it is necessary to configure the object’s methods).

    Assigning an EVENT PROCEDURE to objects means writing a program that starts executing after the occurrence of a certain event. For example, after clicking on a command button, text appears in a text field, or, for example, when opening a window, a sound is heard, and before closing, a prompt appears asking for confirmation to close the window.

    To assign an event procedure to an object, the programmer usually double-left-clicks on the object, and in the PROGRAM CODE window that appears, writes a program in a programming language (this can be Basic, Pascal or C++, depending on the programming system).

    In programming systems, writing a program is as easy as possible, since after double click a window appears on the object program code with a ready-made empty template of an event procedure, all that remains is to use the mouse or keyboard to make some changes in the template (if necessary) and add the program; in the process of compiling a program, the auto hint system can be of great help - the editor automatically offers the programmer a list of operators and functions as needed , object properties - all you have to do is select from the list and click the mouse.

    After placing all the necessary controls on the form, setting their properties and creating event procedures, the program is ready. All that remains is to give the command to broadcast it (for VB, click Start in the toolbar, or the RUN – Start menu, or press F5): Delphi systems and C++ Builder perform the compilation, and the Visual Basic system performs the interpretation.

    Starting the Visual Basic Programming Environment

    Starting the Visual Basic programming environment:

    StartPrograms→ Microsoft Visual Basic 6.0.→ Microsoft Visual Basic 6.0.

    A window appears with three tabs: New, Past, Existing.

    Rice. 1. Window for adding an object.

    Using the window, you can create a new project or open an existing one.

    Creating a new project: New → Standard EXE → Open.

    A project for the future application is created, which may contain forms, modules and other components.

    Open an existing project: Existing → Open the desired folder→ Select the desired project → Open.

    Open an object that was previously opened on this computer: Past → Select the desired project → Open.

    Visual Basic Programming Environment Window

    Rice. 2. Visual Basic programming environment window.

      control panel.

      project explorer window.

      The properties window for the current control or form.

      window for placing the form on the monitor screen.

      window for entering commands. Commands are executed immediately after input.

    If any of the listed elements are not visible, they can be displayed (or hidden) using the View menu.

    View → Toolbar.

    View → Project Explorer.

    View → Properties window.

    View → Form Placement Window.

    View → Emergency Window.

    The form window can be displayed by double-clicking the form icon or name in the project explorer window.