Visual Basic
This book is written from a Visual Basic 6.0 perspective although much of what is said is also valid for Visual Basic 5.0 and Visual Basic 4.0. This book does not cover VB.NET which is in fact a radically different language. It covers many different techniques and topics including optimization of programs, object oriented programming and coding guidelines to name a few. To assist readers in getting started several complete applications of varying degrees of sophistication are presented in the Case Studies chapter.
- Introduction
- This book's sole purpose is to help people better understand Visual Basic.
- History
- A timeline of Visual Basic's history.
- Getting Started
- VB6 IDE (Integrated Development Environment) is highly useful for developing GUI (Graphical User Interface) applications.
- Simple Arithmetic
- Introduction to calculating and operands with Visual Basic.
- Branching
- Branching occurs when the program makes a decision. The flow of execution follows a particular branch like a fork in the road.
- Loops
- Loops are control structures used to repeat a given section of code a certain number of times or until a particular condition is met.
- Strings
- Strings hold printable characters. They are very useful for communicating with human beings and for transferring data between programs and machines in text files and web pages.
- Arrays
- Arrays are used to group data items of the same type together, to make it easier to search and sort through this data.
- User Interfaces
- A user interface is the part of your program that is visible to a human user. It can be as simple as a DOS command line or as sophisticated as an immersive virtual reality simulator. However, in the context of Visual Basic it usually means what is commonly referred to as a Graphical User Interface or GUI which generally consists of one or more Forms that contain text boxes, labels, buttons, picture boxes, etc.
- Simple Graphics
- Visual Basic can easily be used to draw simple graphics such as line drawings and diagrams.
- Files
- While programming, you may want to at some point save data so they may be accessible for further use. This is where file I/O comes in. Visual Basic allows us to perform most operations available in Windows Explorer and DOS command line.
- Data Types
- A datatype is a specification of the kind of information that a variable can hold, for example, a number or a piece of text.
- Procedures and Functions
- A function is a calling procedure or small part of a program that performs some specific task and returns a result; for example the cosine function.
- Windows Dialogs
- Windows dialogs are useful when one requires standard interfaces, including opening files, saving files, choosing color and/or font, specifying printer settings.
- Databases
- Visual Basic can connect to databases in many different ways.
- Windows API
- APIs, short for "application programming interface", allows you to access a wide array of functions and methods exposed by the operating system or other applications (DLLs), performing operations not normally implemented by the standard virtual machine that Visual Basic provides.
- Subclassing
- Visual Basic hides the details of all the messages that Windows sends to an application but you can get at them if you really need to. Then you can do things that plain Visual Basic cannot.
- External Processes
- Sometimes you want to call another program from Visual Basic.
- Object Oriented Programming
- There is a lot of complicated talk about Object Oriented Programming but in essence it is quite simple.
- Effective Programming
- It isn't enough that the program work, you must be able to maintain it as well. Effective programmers can read their code as well as write it.
- Idioms
- An idiom is a sort of template or generic method of expressing an idea. In the same way that idioms in a human language make life easier for the both speaker and listener good idioms in computer programming make life easier for the programmer. Naturally what is idiomatic in one language might not be in another.
- Optimizing Visual Basic
- Once your program is up and running and producing correct results you might want to consider optimizing it. This means making it run faster or use fewer or less expensive resources. As you gain experience you will recognize that some programming idioms produce better results than others under some circumstances. Being able to recognize these situations will enable you to choose the best method straight away.
- Examples
- This section contains a number of ready made code examples for your use. They vary from short snippets to complete modules and short demo applications.
- Regular Expression Tester: A small, almost throwaway application that demonstrates that useful application do not need to be either large or complicated.
- JArithmetic
- The Language
- This section summarizes the syntax of Visual Basic and describes all the key concepts that of Visual Basic. It also notes some features that exist in other languages but do not exist in Visual basic.
- Coding Standards
- Consistent style in coding helps everyone to maintain a program whether the maintainer is the original author or not.
- Selected Functions
- Short descriptions of some of the functions that are used in this book.
- VB6 Command Reference
- This section serves as guide to the commands that can be used in Visual Basic.
- Glossary
- Brief explanations of various important, difficult or otherwise interesting words and phrases with links to longer explanations in the body of the text.
- Work in Progress
- Various unfinished pages. Please look here for anything obscure or difficult.
[edit] Related Works
Anyone who is serious about the art of programming should know about more than one language and should also be conversant with the foundations of computing. As mentioned in the Idioms chapter you can borrow ideas from other languages even if the language you use appears not to support them. Here is a list of suggested works, some on-line some in print.
- Donald Knuth
- The Art of Computer Programming. Knuth's masterpiece, let's hope he lives long enough to complete it.
- Data Structures
- Programs operate on data so knowledge of effective data structures is very important.
- Algorithms
- Many algorithms were described long before computers were available and many have both naive inefficient forms and sophisticated efficient forms. In many cases this is independent of the implementation language.
- Object Oriented Programming
[edit] External Links
| Link | Comment |
|---|---|
| Visual Basic Tutorial | 37 Lessons on Visual Basic 6 and sample source code |
| Visual Basic 6 (VB6) tutorials and source code | Example Visual Basic 6.0 tutorials and source code |
| VBCorLib | Do exceptions in Visual Basic 6.0 |
| Visual Basic Tutorials | |
| WinsockVB | Everything there is to know about sockets and Visual Basic 6.0. Still has active forums. OFF LINE |
| VBSpeed | Objective evidence you can use to help you write faster code |
| GPWiki | Contains more game related Visual Basic tutorials |
| XtremeVBTalk | A VB forum |
| AllAPI | Examples for Windows APIs |
| Hardcore Visual Basic | Bruce McKinney's masterpiece; shows that you can write almost anything in Visual Basic 6.0. |
| Planet Source Code | Sample Source Code |
| VBCode.com | Free Source Code for VB |
| A1VBcode.com | Another Free Source Code site for VB |
| VBexemple.com | Free examples(source code), Tutorials for Visual Basic 6.0 |
[edit] Authors and Contributors
Details of permissions given to include content from other sites and documents is on the Credits and Permissions page.
| Name | Comment |
|---|---|
| Batjew | Wrote almost everything to start, getting help now. |
| EugeneH | Corrected mistakes and wrote the rest. User name is now Orage |
| T94xr | Fixed a dead link and added a couple good sites. |
| kwhitefoot | Added: distinction between Type and Class, optimization of programs. Split into separate chapters. Added coding standards, case studies, optimization. |
| Elliot Spencer | Contributed many examples from his web site: http://www.ilook.fsnet.co.uk/index.htm |
| Aadnk | Some sections translated from the Norwegian Visual Basic WikiBook (by Kwhitefoot). Also wrote the Windows Dialogs chapter. |
| GUI Computing Pty Ltd/Mark Trescowthick | Mark Trescowthick kindly gave permission for the [GUI Computing coding standards] and [Australian Visual Developers Forum] to be used, see Credits and Permissions. |