Sei sulla pagina 1di 29

What is VB(Visual Basic) ?

y Visual Basic is a "visual programming" environment for developing Windows (also

Web now) applications or Graphical application. Visual Basic makes it possible to develop complicated applications very quickly. The programmer designs windows graphically, drags program elements from the Visual Basic Toolbox and writes basic code for each element. Visual Basic is "event-driven" which means that procedures are called automatically when the end user chooses menu items, clicks the mouse, moves objects on the screen, etc.

y Visual Basic 6.0 is a Microsoft product with a lineage since 1991. y Since it launch in 1990, the visual basic approach has become the norm for y y y y y

programming language like c, c++ , java etc. VB is one of the most popular window software development tool. Based on Basic language , VB was one of the first product to provide a graphical programming environment. VB6 is also called object based programming environment , while it has a number of object oriented features . It is sometimes called an event Driven language because each object can react to different events such as a mouse click . VB6 is built around on IDE , that allow rapid development of user interface and the supporting code.

What Is Visual Basic and Why do I need it?


Visual Basic is Easy to learn Programming language. With Visual Basic you can develop Windows based applications and games. Visual Basic is much easier to learn than other language (like Visual C++), and yet it's powerful programming language. Visual Basic suits more for application developing than for Games developing. y You can create sophisticated games using Visual Basic, But y If you want to make a really advanced professional game like Quake 2, You may choose other language (like C++), that would be much more harder to program . y However, Visual Basic will be probably powerful enough to suit all your application and games programming needs.
y y y y y

Why is Visual Basic popular?


y Programmers have undergone a major change in many years of programming

various machines. For example, what could take days to create an application in other programming languages like C, C++ could be done in hours with Visual Basic. Visual Basic provides many interesting sets of tools to aid us in building exciting applications.Visual Basic provides these tools to make our life far more easier because all the real hard code is already written for us. y Visual Basic is not only a programming language but also a true graphical development environment. This environment allows programmers with little programming experience to quickly develop powerful Windows applications. Visual Basic also has the ability to develop programs that can be used as a frontend application to a database system, serving as the user interface which collects user input and displays formatted output in a more appealing and useful form.

y Visual Basic is very popular for the ease with which it allows the programmer to

create nice looking graphical programs with less coding unlike many other languages that take thousands of lines of programmer keyed code. As the programmer works in the graphical environment much of the program code is automatically generated by theVisual Basic program.

Areas of Use
y Using Visual Basic's tools we can quickly translate an abstract idea into a program

design that we can actually see on the screen. VB encourages you to experiment, revise, correct, and network your design until the new project meets your requirements. However, most of all, it inspires your imagination and creativity. Visual Basic is ideal for developing applications that run on the Windows operating system. Developing applications with VB can be said to be a 3-step approach: y i) Design the appearance of application ii) Assign property settings to the objects of the program iii) Write the code to direct specific tasks at runtime

y y y y y y y y y y

Visual Basic is used to develop applications in a number of different areas. Some of them are listed below: Accounting Business Commerce Consulting Education Law Marketing and Sales Medicine Research Science Many of the things that we do with Visual Basic really arent very basic. The Visual Basic language is powerful, if you can imagine a programming task, it can be accomplished using Visual Basic

The advantages of Visual Basic:

y
y y y y y y y

It's simple language. Things that may be difficult to program with other language can be done in Visual Basic very easily. Because Visual Basic is so popular, There are many good resources (Books, Web sites, News groups and more) that can help you learn the language. You can find the answers to your programming problems much more easily than other programming languages. Compare to other languages, Visual Basic have the widest variety of tools that you can download on the internet and use in your programs. It is Easy to use . Suitable for Rapid Application Development. It is one of High Level lenguage. In VB , We can Use a form and controls to create a user interface.

The disadvantages of Visual Basic:


y Visual Basic is powerful language, but it's not suit for programming really y y y y y y

sophisticated games. It's much slower than other languages. VB is not platform Independent . VB is not Vendor Independent. VB is not well documented. VB is not suitable for very large projects which must be maintained over a long period of time. VB is not based on constant Language definition.

History of Visual Basic


Microsoft first released Visual Basic in 1987. It was the first visual development tool from Microsoft, and it was to compete with C, C++, Pascal and other well-known programming languages. From the start, Visual Basic wasn't a hit. It wasn't until release 2.0 that people really discovered the potential of the language, and with release 3.0 it had become the fastest-growing programming language on the market.
Below is the order and the approximate year in which a new version of Visual Basic was released:

y y y y y y y

1991, VB1 Debuts 1992, VB2 Debuts 1993, VB3 Debut 1996, VB4 Debuts 1997, VB5 Debuts 1998, VB6 Debuts 2001, VB. NET Debuts

y Integrated Development Environment (IDE) : The working environment in Visual Basic is often referred to as the integrated development environment or IDE because it integrates many different functions such as design, editing, compiling, and debugging within a common environment. In most traditional development tools, each of these functions would operate as a separate program, each with its own interface. In this section, the following topics are discussed:

Visual Basic Concepts y Visual Studio 6.0 y Starting the Visual Basic IDE When you run the Visual Basic Setup program, it allows you to place the program items in an existing program group or create a new program group and new program items for Visual Basic in Windows. You are then ready to start Visual Basic from Windows.

To start Visual Basic from Windows y Click Start on the Task bar. y Select Programs, Visual Studio and then Microsoft Visual Basic 6.0. or y Click Start on the Task bar. y Select Programs. y Use the Windows Explorer to find the Visual Basic executable file. y Double-click the Visual Basic icon. y You can also create a shortcut to Visual Basic, and double-click the shortcut. y When you first start Visual Basic, you see the interface of the integrated development environment, as shown in Figure 2.1.

y figure 2.1 The Visual Basic integrated development environment

y y y y

Visual Basic Concepts Visual Studio 6.0 Integrated Development Environment Elements The Visual Basic integrated development environment (IDE) consists of the following elements.

Menu Bar Displays the commands you use to work with Visual Basic. Besides the standard File, Edit, View, Window, and Help menus, menus are provided to access functions specific to programming such as Project, Format, or Debug. y Context Menus Contain shortcuts to frequently performed actions. To open a context menu, click the right mouse button on the object you're using. The specific list of shortcuts available from context menus depends on the part of the environment where you click the right mouse button. For example, the context menu displayed when you right click on the Toolbox lets you display the Components dialog box, hide the Toolbox, dock or undock the Toolbox, or add a custom tab to the Toolbox.

y Toolbars y Provide quick access to commonly used commands in the programming

y y y y

environment. You click a button on the toolbar once to carry out the action represented by that button. By default, the Standard toolbar is displayed when you start Visual Basic. Additional toolbars for editing, form design, and debugging can be toggled on or off from the Toolbars command on the View menu. Toolbars can be docked beneath the menu bar or can "float" if you select the vertical bar on the left edge and drag it away from the menu bar. Toolbox Provides a set of tools that you use at design time to place controls on a form. In addition to the default toolbox layout, you can create your own custom layouts by selecting Add Tab from the context menu and adding controls to the resulting tab. or More Information To learn more about specific controls, see "Forms, Controls, and Menus" and "Using Visual Basic's Standard Controls." For information on how to add controls to the Toolbox, see "Adding Controls to a Project" in "Managing Projects."

y Project Explorer Window y Lists the forms and modules in your current project. A project is the collection of files you use to build an application. y For More Information For information on projects, see "Managing Projects." y Properties Window y Lists the property settings for the selected form or control. A property is a characteristic of an object, such as size, caption, or color. y For More Information For information on properties, see "Understanding Properties, Methods, and Events" in "Forms, Controls, and Menus." y Object Browser y Lists objects available for use in your project and gives you a quick way to navigate through your code. You can use the Object Browser to explore objects in Visual Basic and other applications, see what methods and properties are available for those objects, and paste code procedures into your application. y For More Information For more information on using the Object Browser to view procedures, see "Finding Out About Objects" in "Programming with Objects." For details on using add-ins to extend the Visual Basic programming environment, see "Using Wizards and Add-ins" in "Managing Projects."

y Form Designer y Serves as a window that you customize to design the interface of your

y y y y y y y

application. You add controls, graphics, and pictures to a form to create the look you want. Each form in your application has its own form designer window. For More Information To learn how to add controls to an application, see "Your First Visual Basic Application" later in this chapter. To learn more about designing an interface, see "Creating a User Interface." Code Editor Window Serves as an editor for entering application code. A separate code editor window is created for each form or code module in your application. For More Information To learn more about entering code and using the code editor, see "Programming Fundamentals." Form Layout Window The Form Layout window (Figure 2.2) allows you to position the forms in your application using a small graphical representation of the screen. Figure 2.2 The Form Layout window

y Immediate, Locals, and Watch Windows y These additional windows are provided for use in debugging your

application. They are only available when you are running your application within the IDE. y or More Information To learn more about debugging and using the debug windows, see "Debugging Your Code and Handling Errors." y Note You can also add features to the Visual Basic interface by using a program called an add-in. Add-ins, which are available from Microsoft and third-party developers, can provide features like source code control, which allows you to support group development projects.

Visual Basic Concepts Visual Studio 6.0 Environment Options Visual Basic provides a great deal of flexibility, allowing you to configure the working environment to best suit your individual style. You can choose between a single or multiple document interface, and you can adjust the size and positioning of the various Integrated Development Environment (IDE) elements. Your layout will persist between sessions of Visual Basic. y SDI or MDI Interface y Two different styles are available for the Visual Basic IDE: single document interface (SDI) or multiple document interface (MDI). With the SDI option, all of the IDE windows are free to be moved anywhere on screen; as long as Visual Basic is the current application, they will remain on top of any other applications. With the MDI option, all of the IDE windows are contained within a single resizable parent window.
y y y y

y y y y y y y y

To switch between SDI and MDI modes Select Options from the Tools menu.The Options dialog box is displayed. Select the Advanced tab. Check or uncheck the SDI Development Environment check box.The IDE will start in the selected mode the next time you start Visual Basic. or Run Visual Basic from the command line with a /sdi or /mdi parameter. Docking Windows Many of the windows in the IDE can be docked, or connected, to each other or to the edge of the screen. These include the Toolbox, Form Layout Window, Project Explorer, Properties window, Color Palette, and Immediate, Locals, and Watch windows. With the MDI option, windows can be docked to any side of the parent window; with SDI they can only be docked beneath the menu bar. Docking capabilities can be toggled on or off for a given window by selecting the appropriate check box on the Docking tab of the Options dialog box, available from the Options command on the Tools menu.

To dock or undock a window


y Select the window you wish to dock or undock. y Drag the window to the desired location by holding down the left mouse button. y The outline of the window will be displayed as you drag. y Release the mouse button.

y Elements of User Interface: A programs user interface refers to the part of the

program that the user sees and interacts with. As the applications interface is developed, we will see how the different tools available in the visual basics IDE can be used. The different controls available on the toolbox, menu bar and toolbar constitute the user interface. The Visual Basic tools falls in three categories:

y Intrinsic controls/ Standard controls y ActiveX controls y Insert able objects.

y Following are the list of standard controls and their functionality y Pointer: Provides a way to move and resize the controls form. y Picture Box: Displays icons/bitmaps and metafiles. It displays text or y y y y y y y

acts as a visual container for other controls. Text Box: Use to display message and enter text. Frame: Serves as visual and functional container for controls. Command Buttons: Used to carry out the specified action when the user chooses it. Check Box: Displays a True/False or Yes/No option. Option Button: Option Button control which is the part of an option group allows the user to select only one option even it displays multiple choices. List Box: Displays a list of items from which a user can select one. Combo Box: Contains a Text Box and a List Box. This allows the user to select an item from the dropdown list box, or type in a selection in the Text Box.

y HScrollBar and VScrollBar: These controls allow the user to select a value y y y y y y y y y y

within the specified range of values. Timer: Executes the timer events at specified intervals of time. Drive List Box: Displays the valid disk drives and allows the user to select one of them. Dir List Box: Allows the user to select the directories and paths, which are displayed. File List Box: Displays a set of files from which a user can select the desired one. Shape: Used to add shape to a form. Line: Used to draw straight line to the form. Data: Enables the use to connect to an existing database and display information from it. Image: Used to display images such as icons, bitmaps and metafiles. But less capability than the Picture Box. OLE: Used to link or embed an object, displays and manipulate data from other windows based applications. Label: Displays a text that the user can not modify or interact with.

Potrebbero piacerti anche