Wal Mart Online → Best Selection![]() |
Last Modified:
|
|||||||||||||||||||||||
|
Home Visual Basic Introduction to VB.NET.NET Framework VS2008 IDE How VB is Compiled Start Visual Studio Windows Form App Save Your Work VB OOP ProgrammingVisual Basic Code Exit Code Button Event Code Coding RecommendationsIf/Then/Else Error List Window Comment Syntax Help Window Language Essentianl Built-In Data Types Declare Variables Declare ConstantsCode Arithmetic Expressions Assignment Statements Operator Precedence Type Casting Math Class String DeclarationConversion Functions Conversion Methods Formatting Functions String Formatting Variable Scope EnumerationsNullable Types Loop Constructs For Next LoopDo While Loop Do Until Loop Do...Loop-WhileDo...Loop-Until Exit Do | Exit For Do...LoopNested Loops Arrays Array DeclarationRnd( ) Function Listbox ControlKeyPressEventArgs Parallel Arrays Key Event ArgsDynamic Arrays Redimension ArraySet Breakpoint Start Debugger ReDim Preserve MultiDimensional Arrays DataGridView ControlLength and Sort Methods Structures Pad RightSplit Method IsNumeric Function Multiform Projects Add Form To Project Form Object Methods Form Show Method ShowDialog Method Form Close Method Form Accept Button Multiform Project Example ASP.NET Web Programming Create Data SourceConfigure Access Data Source Add Product Class Extract Local Database Data Order PageLoad VB CodeAdd New Web Page Set Start Page Display Cart Aspx CodeDisplay Cart Design View Sorted List Definition VB.NET Session State Create CartItem Class GetCartContents FunctionAdd To Cart Event Handler Remove Cart Item EventClear Cart Event Handler |
Save Your Work!!It is recommended that you save your work at frequent intervals by executing the File → Save All option from the File Menu as indicated in the diagram below:
The first time that you perform a File → Save All operation, Windows will notice that there is no previously saved copy of the project. This will give you the opportunity to save your project under a different name or in a different location. This is especially useful when you are making a copy of a previously written program that you would like to start as a new project. By selecting the Browse button, you may make changes as you deem appropriate. At this time, however, for simplicity, we are going to keep all the default values as Windows as selected them for us. Press Save as indicated in the diagram below:
At this point we have written no code in our Visual Basic project.
So, if we were to
"Run" this program there
should be no errors and the program should execute and terminate
"smoothly". To test this out, Press the
Green Triangle
Theoretically, all should go well, and a new copy of our Invoice Total Form should display. This will be what to expect if our startup code has no errors. The diagram below shows the Invoice Total Form at Runtime with none of the controls activated:
Introduction to Visual Basic Object Oriented ProgrammingWhether you realize it or not, you are using object-oriented programming as you design a Windows form with Visual Studio's Form Designer. That's because each control on a form is an object, and the form itself is an object. These objects are derived from classes that are part of the .NET Class Library. When you start a new project from the Windows Application template, you are actually creating a new class that inherits the characteristics of the Form. The Form, in turn, is part of the .NET Class Library. Later when you run the form, you are actually creating an instance of your form class, and this instance is known as an object. Similarly, when you add a control to a form, you are actually adding a control object to the form. Each control is an instance of a specific class. For example, a text box control is an object that is an instance of a specific class. For example, a TextBox control is an object that is an instance of the TextBox class. Similarly, a label control is an object that is an instance of the Label class. This process of creating an object from a class can be called instantiation. As you progress through this guide, you will become more familiar with classes and objects because Visual Basic is an object-oriented language. Later we will actually create classes. At that point, we can start to understand what is happening as we work with classes and objects. For now, we will just get comfortable with the terms and concepts and understand that a lot is going on behind the scenes, and we will begin to understand those processes as we progress through this guide. To help illustrate this concept observe the following diagram:
Adding Code to the Invoice Total FormMake sure that the Invoice Total program has been terminated by pressing the
Red 'X'
Double-Clicking the
Button
will bring up the source code window. To view the source code for the |
![]()
|