Programming Languages

Like any other language, a programming language uses grammer, punctuation, and different parts of speech. A computer, though, cannot understand any person's spoken language, like English or Spanish. It is too ambiguous and general for computers to comprehend these. So a special kind of language is needed to control and take advantage of computer hardware. This leads us to one of VB's most noteworthy features: its language. The statements made in VB's language never have multiple meanings within the same context and they are not ambiguous. This is a key difference between other programming languages and it's what makes it easier for beginners. Throughout this tutorial you will pick up bits and pieces of the language and eventually learn the syntax and vocabulary of VB, just as you might learn a spoken language.

Once you grasp some of the syntax you will be able to embed instructions or code into your application. Code is the most integral part of programming in VB. It glues the processes, text, and graphics together to form a working application. Without it you would have a bunch of windows that do nothing. Code lets you, the application writer, tell the application exactly what to do, when to do it, and so forth.

 

The Programming Process

This section outlines the basic steps you will follow to create your first application in Visual Basic. You won't follow all of these sequentially or in one sitting. These will be re-visited as often as needed to fine-tune your program. This is the basic syntax for all programming development and is common among every programming language.

 

  1. Run the IDE (see next section)
  2. Select either a new application(standard .exe) or one you have been working on. Feel free to try out the application wizard, experimentation is vital for learning anything.
  3. Debug* your application. This is where Developer Studio really shines. You can run, debug and correct your application very quickly.
  4. Compiling is the next logical step once you've decided your application is complete and you do not want to add any more code to it. Be certain you are ready to compile and that all of the bugs in your application have been corrected.
  5. Finally, distributing your application to your users.

 

*Debugging is a phrase that harkens back to the more primitive times of computing. Before the transistor came along there were vacuum tubes...and lots of them. Moths and other light-attracted insects would get inside these tubes and computer operators would have to replace them, hence the phrase. The process of "debugging" is removing errors in your code. Just as you may mispronounce a phrase in English or use incorrect syntax(i.e.ain't, ya'll; my apologies to any southerners reading this), you can also make language errors in programming. These errors are called bugs.

 

Running Visual Basic IDE (Integrated Development Environment)

This section focuses on the Visual Basic Integrated Development Environment. As mentioned in the previous section, an IDE is an environment on the computer in which you develop and compile programs. As time goes on, and you spend more and more time programming, you will become intimately familiar with this environment. A short overview is needed to get started, and from there you can explore the rest. It is assumed that you have basic knowledge of navigating within Windows and it is recommended that you are comfortable with the environment and its parts, like resizing windows, working with the menu system and other features. If you can do those things you have all the prerequisites for this tutorial.

 

Getting to Know The VB IDE

To begin open Visual Basic by double-clicking its icon on the desktop or finding it in the Start menu. On most operating systems you should see a start-up screen. This is the New Project dialog box. If you do not see the New Project dialog box press Ctrl + N, or alternately select it from the File menu. If you don't want to see this every time you open the IDE, check the box labeled 'Don't Show this dialog in the future'. You have many different project types to choose from, but for now click Standard EXE twice to select it. This will be the usual project type you will select when starting a new program. After choosing which type of project, the development area loads. This may look daunting at first, but it's easy, you can fully customize it to fit your needs as a coder. Over time you'll want to adjust the screen's window sizes to your liking and kill certain windows you don't like. You can exit the IDE simply by choosing Exit in the File menu or by pressing Alt + F4. Before quitting, if you have made any changes in your code, VB will prompt you to decide whether or not you would like to save these.

The VB IDE is'nt something you can learn right away, and it'll take some hours in front of the computer to really get a handle on all of its options, but it's important you know the basics and how to maneuver around in the developing area. Plus, as mentioned earlier, after learning this IDE you will have also learned the IDEs for Visual C++ and Visual J++. You'll have a better idea of phrases used in proceeding sections of this tutorial if you take the time now to familiarize yourself with Figure 1. It dentifies some of the parts of the IDE that you'll be using frequently, familiarize yourself with what each window is called, so you'll know what I'm talking about in future sections and don't hesitate to refer back to it if you forget.

 

The primary windows you will be working in during development are the Form windows. As labeled above in Figure 1. By default, the IDE displays one form, Form1. So, if you write a Windows-based interest calculator with this form, the calculators buttons, text and graphics all reside in Form1. You can resize the form window inside the IDE by clicking on the small box on the bottom-right corner of the form, this will stay the default size after you compile the program, so make sure the form's size is what you want. So where's the code? The form just holds the program's interactive items, such as a command button, text boxes and labels. The code appears in a special window called the Code window. This does'nt appear in Figure 1 but you can see the code window by double-clicking on Form1 or alternately clicking View on the menu bar and then selecting Code. The Code window is a text editor, much like notepad or Microsoft Word. This is where you will actually program.

 

The program in Figure 1 was created by opening a New Project, and adding objects from the Toolbox on to the form. These tools interact with the user in various ways. This is a process you will be doing with simple programs as well as advanced applications. You'll begin with a blank form and add buttons and other items and tie it all together with code located in the Code window. Perhaps you'd like a form within a form. A good example of this type of program is Microsoft Word. In Word, you can open multiple documents and minimize them inside the main form of Word, allowing you to edit multiple documents at once. This multiple-form type application is called a MDI(multiple-document interface). Logically a program only requiring one form is an SDI or Single Document Interface, a good example of a SDI application is notepad, which only allows you to edit one document at once.

 

 

part3

Hosted by www.Geocities.ws

1