Object-Oriented Programming in Visual Basic .NET

What is Visual Basic .NET ?


Visual Basic was first released by Microsoft in the early 1990s. At that time, Visual Basic Version 1 (VB1) was a revolutionary product that introduced a new style of computer programming to the world.
Previously, computer programs were most commonly written as lines of text which were instructions to the computer describing how to perform some task. Every part of a program was written as one or more lines of text that described some aspect of the task to be performed. This was regardless of whether the program was created in C, Pascal (popular programming languages of the time) or any other programming language.
Microsoft had introduced Windows version 3.0 (the first popular version of Windows) a few years before this, and was determined to make it the standard operating environment for IBM PC compatible computers. To improve the popularity of Windows, Microsoft knew that a wide range of software products would need to become available as quickly as possible.
However, it was difficult to write Windows programs because of the complex ways in which users could interact with them: a good Windows program would allow the user to control it with a mouse, selecting commands from menus, moving easily between interactive screen elements and, above all, move between several programs apparently running simultaneously in a single system. All of these requirements imposed a heavy burden on programmers, who for the first time had to concede that the user of a program was entitled to exercise a degree of flexibility
and control that was previously not attainable.
Visual Basic was introduced as the saviour of Windows, making it possible to create programs that reacted to user interactions in a way that was natural for the programmer to incorporate. Two key elements gave Visual Basic its power and ease of adoption: the ‘Visual’ element of the language, which allowed a programmer to design a user-interface by drawing its appearance on the computer screen and configure it interactively, and a new model of programming which allowed the programmer to write ‘scripts’, or mini-programs that were activated as a response to the user interacting with the user-interface.
Over several versions, Visual Basic gradually grew in power and popularity to become the world’s most widely used programming system. It also became Microsoft’s standard scripting language for its range of office products, its web browser and servers and a number of third party products such as AutoCAD.


Learning to program

Learning to use a programming language is not the same as learning to develop software. Well, it is in a way, since when you are developing software you will certainly have to use a programming language to finish the job. However, there is more to developing software than writing programs. Most professionally developed software is hugely complex, and as such it has to be constructed in an environment that takes account of that complexity. No matter who you are, if you are learning how to program you should be aiming to do it to a professional standard.
Programming, the act of writing computer software to add some function to a computer system, is one part of software development. However, in many cases it may be only a small part. The other things that are done during software development are there to support the act of programming in the same way that architecture, surveying and civil engineering are there to support building. Sometimes, we need this additional support to make the act of programming safe and accurate. At other times we do not.
The aim of this book is to show you how to write programs in Microsoft Visual Basic .NET. If it is successful in this, you may go on to write large, best-selling programs, but not unless you pick up a lot of other skills as well. Nevertheless, the subject of this book is programming in Visual Basic .NET, and you can expect the vast majority of the material in here to be just about those things programming first, programming in Visual Basic .NET as a close second. However, it would be doing everyone a great disservice if some time was not spent laying the foundations for programming.
Probably the first thing that needs to be explained to those new to programming is that it is never as hard as it seems. It may take you a while to tune into the various bits of vocabulary, the idioms used and even the downright technical stuff, but nothing hard is ever being done complex in the sense that programming can involve many different components yes, but not hard. A program is simply a set of instructions to a very dumb servant (a computer of course) to get it to do something. Most often, that something is to manipulate information, but there are certainly some computer systems where manipulating information is just one part of the job. Controlling an industrial robot, or a car engine, for example, may require a program to manipulate information, but that is not the goal.
For our purposes in this book, everything we do will be to manipulate information (it would not be sensible to unleash a novice programmer on an industrial robot control system or car engine management). The good thing about this is that there is no danger involved. The really good thing is that when you are learning to program, there are no simulators you just do it and the results are (normally) immediate.
Your program works, and you go on to the next program, or it doesn’t, and you get to try to find what is wrong with it. Either way you will have learned something practical. I can think of no other skill to learn where the results are so immediate and so satisfying (of course the down side of this is that frustration can figure quite highly as well).


Komentar