Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 4 - Using Methods with Object Oriented Databas...
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 
Moblin 
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

Using Methods with Object Oriented Database Development with VB.NET 2005
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 16
    2006-07-19

    Table of Contents:
  • Using Methods with Object Oriented Database Development with VB.NET 2005
  • Developing methods with parameters having default values
  • Dealing with method overloading to attain more flexibility
  • Developing methods with parameters as objects
  • Developing methods which return objects

  • 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

    Using Methods with Object Oriented Database Development with VB.NET 2005 - Developing methods with parameters as objects


    (Page 4 of 5 )

    In the previous section, I explained two different methods with the same name, "add." Now, I shall further extend the same class with one more method (again with the same name) with a different type of parameter, just to extend its flexibility further. Let us go through the code now:

    PublicSub add(ByVal objEmp As Emp)
            m_empno = objEmp.m_empno
            m_ename = objEmp.m_ename
            m_sal = objEmp.m_sal
            m_deptno = objEmp.m_deptno
            add()
        End Sub

    The above method will be the third method with the name "add" (but with a difference in parameters), still strengthening the "method overloading" concept.  The above method accepts a different type of parameter. It is nothing but a parameter which accepts an object of the type "emp" class. 

    To execute the above method, you need to create a separate object of type "emp," assign values to the fields and pass the same object as a parameter, while calling the method "add." The code is shown below:

    PrivateSub btnAdd_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles btnAdd.Click
            Me.lblErrMsg.Text = ""
            Try
                Dim objParam As New Emp
                With objParam
                    .m_deptno = Me.txtDeptno.Text
                    .m_empno = Me.txtEmpno.Text
                    .m_ename = Me.txtEname.Text
                    .m_sal = Me.txtSal.Text
                End With
                Dim ep As New Emp
                ep.add(objParam)
            Catch ex As Exception
                Me.lblErrMsg.Text = ex.Message
            End Try
        End Sub

    More Visual Basic.NET Articles
    More By Jagadish Chaterjee


       · Hello guys! this is my next contribution on database oriented OOPS with VB.NET 2005....
     

    VISUAL BASIC.NET ARTICLES

    - Movement and Player Statistics in a VB.NET T...
    - 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...




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