Home

The StoreItem Library

 

Introduction

This is a library used by various articles on this site. These are the steps to create it.

Practical Learning Practical Learning: Creating the StoreItem Library

  1. To create a new project, on the main menu, click File -> New -> Project...
  2. In the Project Types list of the Add New Project dialog box, click Visual Basic Projects
  3. In the Templates list, click Class Library
  4. Change the Name to StoreItem
     
  5. Click OK
  6. In Solution Explorer, right-click Class1.vb and click Rename
  7. Change the name to StoreItem.vb and press Enter
  8. Change the file as follows:
     
    <Serializable()> Public Class CStoreItem
        Private nbr As String
        Private nm As String
        Private sz As String
        Private uprice As Double
    
        Public Sub New()
            nbr = ""
            nm = ""
            sz = ""
            uprice = 0.0
        End Sub
    
        Public Sub New(ByVal number As String, ByVal name As String, _
                       ByVal size As String, ByVal price As Double)
            nbr = number
            nm = name
            size = sz
            uprice = price
        End Sub
        Public Property ItemNumber() As String
            Get
                Return nbr
            End Get
            Set(ByVal Value As String)
                nbr = Value
            End Set
        End Property
        Public Property ItemName() As String
            Get
                Return nm
            End Get
            Set(ByVal Value As String)
                nm = Value
            End Set
        End Property
        Public Property ItemSize() As String
            Get
                Return sz
            End Get
            Set(ByVal Value As String)
                sz = Value
            End Set
        End Property
        Public Property UnitPrice() As Double
            Get
                Return uprice
            End Get
            Set(ByVal Value As Double)
                uprice = Value
            End Set
        End Property
    End Class
  9. To create the library, in the Solution Explorer, right-click the StoreItem node and click Build
  10. Close Visual Studio .NET
 

Home Copyright © 2004-2010 FunctionX, Inc.