Monday, August 4, 2008

Creating Your First Program

As soon as you start Visual Basic, the Application wizard is there to help. The New Project dialog box, appears when you start Visual Basic from the Windows Start menu. The tabs on the New Project dialog box offer these choices:
  •  New: lets you create new applications by using various wizards or starting from scratch.
  •  Existing: lets you select and open an existing Visual Basic project.
  •  Recent: displays a list of Visual Basic projects you’ve recently opened or created.

When you select the icon labeled VB Application Wizard on the New tab, the wizard begins its work. The first screen that the wizard displays is an introductory title screen that explains the wizard is about to begin. As with most wizards, when you finish reading and selecting from one wizard screen, you click the Next button to display the next screen that the wizard has to offer. Figure shows the next wizard screen from which you must select an interface type.
Here are the options from which you can select:
• Multiple Document Interface (MDI) allows your application to contain multiple document windows. In effect, this interface lets you work with several sets of data in multiple windows within your program. Each document window is called a child window.
• Single Document Interface (SDI) limits your application to one open document window at a time. Most applications that you write will probably be SDI applications.
• Explorer Style lets your application take on a Windows Explorer-like interface with topic summaries in the left window and details for a selected topic in the right pane.
You can click any of the three options to read a description and see a thumbnail sketch of a sample program window. Many of your applications will contain the single document interface because many applications require only a single window with data that is open at any one time.

The Application wizard adds the menu options that you select to your application menu. The options are common Windows options found on most Windows programs. The menus will be the typical Windows drop-down type.
The ampersand (&) next to a letter in a menu name indicates the underscored accelerator key letter; in other words, &New indicates that New (notice the underscore) appears on the menu and that the user can select the option by pressing Alt+N. If you want to place an actual ampersand in the name, use two; for example, typing A&&B produces A&B.
The next wizard screen, lets you select the toolbar buttons that your application will have. As you can see, the Application wizard does a lot of work for you. By creating an initial toolbar, the wizard takes care of a lot of tedium that you would otherwise have to handle. The left window pane indicates the available toolbar buttons and the right window pane lists the buttons on your application’s toolbar. As with the menu options in the previous screen, click Next to accept all the default toolbar settings.

The next wizard screen to appear is the Resource screen from which you can elect to use resources in your program, such as Multilanguage text files. Simple programs often do not require external resources. For this example, keep the option labeled No checked and click the Next button to continue.


Friday, August 1, 2008

Understanding Program Maintenance for VB 6

Bugs are not the only reason that you will work on a program after you think you’re completely done with it. Program maintenance is necessary because requirements change, companies change, and laws change. You must also change the programs you write so that they remain viable programs; you will need to update your program periodically to reflect changes that impact the program. In addition, users will think of new things that they want the program to do.
It is said that a program is written once and modified many times. The more program maintenance you perform, the more likely that your program will be up-to-date and in use. You may want to release new versions of your program
so that users can, with a different version number on the opening screen that you place there, keep track of the latest version installed on their system.
As you learn more about the Visual Basic programming language, you’ll learn how to write code that is clear, and you’ll learn how to create documentation for your program. The more remarks you put in your program and the clearer you write program code instead of using tedious, complicated, tricky program statements, the easier it will be for you and others to track errors and maintain the program later.

The Programming Process in VB 6

Over time you’ll find your own way of writing programs that works best for you. Nevertheless, you’ll generally follow these standard set of steps when creating your Visual Basic programs:
  1. Decide what your application is to do by creating an overall design.
  2. Create the visual portion of your application (the screens and menus that your users will interact with).
  3. Add Visual Basic programming language code to tie the visual elements together and to automate the program.
  4. Test your application to locate and remove any bugs you find.
Compile your tested application and distribute the compiled application to your users.By waiting until you’ve thoroughly tested your Visual Basic application program before you compile the program, you help speed up the testing process. When you test your program interactively, you can locate and correct bugs that you find more easily and quickly. Visual Basic includes a special helper system called a debugger that you can use to help you locate bugs that appear during testing.
Before Visual Basic, writing a program was more tedious for several reasons.In a text-based environment, you would have to design on paper all the screens that the user would see. You would then take that paper to the users to see if you were designing exactly what they wanted. If you were designing a program for mass distribution, such as a game or a general-purpose business application, you would still write down all the screens, create complicated data flows to and from the various screens, design the disk files needed by the
program, and basically plan every detail before you ever went to the keyboard.Visual Basic’s visual nature encourages you to go to the keyboard much earlier in the programming process. Instead of using paper, you’ll design screens with Visual Basic’s tools.

Visual Basic’s Visual Nature

Visual Basic 6 is more than just a programming language. The secret to Visual Basic is in its name: visual. With today’s Windows operating systems, a program must be able to interact with the screen, keyboard, mouse, and printer graphically. Older programming languages, such as BASIC, worked well in a text-only computing
environment, but such languages do not support the graphical interface needed for today’s computers.
Versions of Visual Basic 6.0
-----------------------------------------------
Visual Basic comes in several varieties including the following:
Visual Basic Enterprise Edition: Created for team programming environments and client/server computing where applications distribute processing and data among several computers.
Visual Basic Professional Edition: Geared toward professional programmers who want to get the most from the Visual Basic programming environment. This edition includes a full set of tools and wizards that help you package and distribute applications. This 21-day tutorial assumes that you use the Professional Edition as most Visual
Basic programmers do. Nevertheless, if you use one of the other editions, the majority of this book also applies to you because this tutorial does not focus on the Professional Edition-only tools as much as it presents a well-rounded introduction to the Visual Basic programming environment and language.
Visual Basic Learning Edition: The essentials with the standard complement of programming tools and everything one needs to get started programming. A multimedia CD-ROM called Learn VB Now comes with the package as well as a full set of Microsoft Developer Network documentation so that you will have the help that you require to learn and use Visual Basic.

Visual Basic 6 : An introdution video tutorial

Welcome to Visual Basic 6

Introduction
---------------

Visual Basic is an enjoyable language due to its visual environment. Much of building a Windows program in Visual Basic requires dragging and dropping graphic objects onto the screen from a toolbox which houses those objects. Your Windows program appears before your eyes as you add the objects. Visual Basic is one of the first programming languages to incorporate a true WYSIWYG (What You See Is What You Get) environment. The program that you build looks like the program your users see when they run the program from Windows.
QBasic is a language supplied with PCs for years, but QBasic offers only a slow, text-based MS-DOS programming environment. Despite its archaic text-based mode, the QBasic language provides a wonderful introduction to Visual Basic because Visual Basic’s programming language is an extension of QBasic. Some people want to program but have never programmed in any other language before, so not only is Visual Basic brand new but so is the nature of programming.
Visual Basic is much more than just a programming language. The programming language forms the background of all that takes place in a running Visual Basic program. Nevertheless, the language is a secondary
consideration to the user interface. A Windows program offers a high degree of user interaction using the graphical elements that form the objects on the window the user sees. If the user interface is not correct, users will not like the program. The programmer will get more support phone calls. The users will be hesitant to upgrade to future program enhancements.
The application of VB is as :
• Building a useful user interface
• Using the Application Wizard to generate a program shell instantly
• Writing Visual Basic code in clear constructs to make the code run smoothly
• Understanding the most common tools used in the Visual Basic environment
• Mastering the art of getting the errors out of a Visual Basic program
• Incorporated database technology into your Visual Basic programs
• Embedding Internet access in the heart of your programs to put your users online to the Web
• Providing external ActiveX controls so that Visual Basic can use tools from other languages and Windows applications
• Using Visual Basic’s ability to create brand new ActiveX controls so that you can increase Visual Basic’s programmability and the tools that your users interact with by making your own interface objects
• Accessing the online help engine in Visual Basic so that the programs that you write are accessible to your users and offer the help services that your users require
• Creating graphics to add pizzazz to the screens that you design
• Using common dialog boxes so that your users can access the typical features they expect in a Windows application
• Putting toolbars and coolbars in your programs so that your users have one-button access to the common commands and tasks they require
• Mastering the art of programming the Windows API routines so that you can implement Windows features not normally found inside Visual Basic
• Improving the enjoyment of the programs that you write by adding multimedia sound and graphics to your Windows programs