SunQuest
 
       Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 2 - Developing Namespaces in VB.NET 2005
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
VeriSign Whitepapers 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

Developing Namespaces in VB.NET 2005
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 7
    2006-09-11

    Table of Contents:
  • Developing Namespaces in VB.NET 2005
  • A simple example of a namespace
  • Accessing a class available in a namespace
  • A namespace with more than one class
  • A simple example for a nested namespace
  • Summary

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Developing Namespaces in VB.NET 2005 - A simple example of a namespace


    (Page 2 of 6 )

    In my previous article (“Inheritance in VB.NET 2005”), I declared three classes, namely “First,” “Second” and “Third.”  I shall use the same solution and further extend it with examples of “namespaces.”

    The simplest construction of a namespace would be as follows:

    NamespaceNamespace1
    EndNamespace

    Every namespace should start with the keyword “Namespace” followed by the name of the namespace (in this case, it is “Namespace1”).  It is always recommended to name the namespace in a meaningful manner to identify a group of classes. 

    To the same solution, add a new class file named “Namespace1_First.vb” and modify the code as follows:

    NamespaceNamespace1
        Public Class First
            Private m_a As Integer
            Private m_b As Integer
            Public Sub New(ByVal x As Integer, ByVal y As Integer)
                m_a = x
                m_b = y
            End Sub
            Public Property A() As Integer
                Get
                    Return m_a
                End Get
                Set(ByVal value As Integer)
                    m_a = value
                End Set
            End Property
            Public Property B() As Integer
                Get
                    Return m_b
                End Get
                Set(ByVal value As Integer)
                    m_b = value
                End Set
            End Property
        End Class
    EndNamespace

    The next section will give you the explanation and sample code to activate the  example shown above.

    More Visual Basic.NET Articles
    More By Jagadish Chaterjee


       · Hello guys! Expand your knowledge of OOPS to namespaces. thanks and bye
     

    VISUAL BASIC.NET ARTICLES

    - Creating and Drawing a Game Map in VB.NET
    - Working with Classes and Properties for Game...
    - Working with Loops, Arrays, and Collections ...
    - Learning Loops in VB.NET for Game Development
    - Learning VB.NET: Working with Variables, Con...
    - The Basics of VB.NET Through Text Game Devel...
    - Learning VB.NET Through Text Game Development
    - Types of Operators in Visual Basic
    - Operators
    - Understanding Custom Events using Visual Bas...
    - Polymorphism using Abstract Classes in Visua...
    - Shadowing using Shadows in Visual Basic.NET ...
    - Overloading and Overriding in Visual Basic.N...
    - More on Controlling Windows Fax Services Usi...
    - Programmatically Controlling Windows Fax Ser...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway