Hot-Link Menu in Right-Side Column

Wal Mart Online → Store Pickup → Free Shipping

Add Product Class

We will need to add some classes to the ChoppingCart Project. Select Project &rarr Add Class... as indicated in the diagram below:

Add Class to VBNet Project

Figure CC-11: Add Product Class to Chopping Cart Project

Buy from Centurion

Enter the Name: Product to the class Name as indicated in the diagram below, then press Add:

Add File Class Product to Project

Figure CC-12: Add Class Product to Chopping Cart Project

Help Support Mr. Centurion - Donate or Visit any Sponsor

No Purchase Necessary.

Help us keep this site operational by making a donation. Any amount is greatly appreciated. OR, if you visit our sponsor, they will make a donation for you, just for visiting.

Thank you

Change the contents of the Product.vb class file that you just created to exactly as illustrated in the diagram below:

Imports Microsoft.VisualBasic

Public Class Product
    Public ProductID As String
    Public Name As String
    Public ShortDescription As String
    Public LongDescription As String
    Public UnitPrice As Decimal
    Public ImageFile As String
End Class

Test the application to make sure we have no errors at this point. Run the program by pressing the Green Triangle . Correct any errors, then test the Drop Down List (ddlProducts). The Drop Down List should display products as displayed in the diagram below:

Expand Drop Down List Control

Figure CC-14: Running Program and Expanding Drown Down List

Excellent Tech Support - Centurion Approved

In the next section we are going to use a Dataview object. A major function of the Datview object is to allow data binding on both Windows and Web Forms. We will use a DataView object to bind to one row of our database, to ease extraction of the data.

To extract the data from the AccessDataSource control and place it in the DataView object will require the use of the CType function. The CType function returns the result of explicitly converting an expression to a specified data type, object, structure, class or interface. The syntax is:

CType(Expression, TypeName)


  • Expression: Any valid expression.
  • TypeName: Any expression that is legal within an As clause in a Dim statement.
    • Any DataType, Object, Structure, Class, or Interface.

To select which data row we are going to extract from theAccessDataSource control we will use the following expression:



  • AccessDataSource1: The Control whose Data is bound to this application.
  • Select: Method which retrieves data from the bound database using the SQL Select statement.
  • DataSourceSelectArguments: Method providing a mechanism that data bound controls use to request data-related operations from data source controls when data is retrieved.
  • Empty: Property that gets the DataSourceSelectArguments with the sort expression set to an empty string (no sorting).
Visit Our Sponsor to Help Support Our Site - No Purchase Necessary

Change the name of the current page from Default.aspx to Order.aspx as illustrated in the diagram below:

Change name frome Default.aspx to Order.aspx

Figure CC-15: Change Name from Default.Aspx to Order.aspx

Changing where you order your computer and electronics from may turn out to be beneficial for you as well. Choose Centurion Online for Top Quality products from brand name manufacturers at competitive pricing

In order to continue with this guide, and continue the discussion on Displaying the Selected Product Data: Press the Button below:

Visit Our Sponsor to Help Support Our Site - No Purchase Necessary


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 Programming

Visual Basic Code

Exit Code

Button Event Code

Coding Recommendations


Error List Window

Comment Syntax

Help Window

Language Essentianl

Built-In Data Types

Declare Variables

Declare Constants

Code Arithmetic Expressions

Assignment Statements

Operator Precedence

Type Casting

Math Class

String Declaration

Conversion Functions

Conversion Methods

Formatting Functions

String Formatting

Variable Scope


Nullable Types

Loop Constructs

For Next Loop

Do While Loop

Do Until Loop



Exit Do | Exit For


Nested Loops


Array Declaration

Rnd( ) Function

Listbox Control


Parallel Arrays

Key Event Args

Dynamic Arrays

Redimension Array

Set Breakpoint

Start Debugger

ReDim Preserve

MultiDimensional Arrays

DataGridView Control

Length and Sort Methods


Pad Right

Split 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 Source

Configure Access Data Source

Add Product Class

Extract Local Database Data

Order PageLoad VB Code

Add New Web Page

Set Start Page

Display Cart Aspx Code

Display Cart Design View

Sorted List Definition

VB.NET Session State

Create CartItem Class

GetCartContents Function

Add To Cart Event Handler

Remove Cart Item Event

Clear Cart Event Handler

Can't open VisitorHistory.txt for reading