Help with class

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gsb58@hotmail.com

    #1

    Help with class

    Hi!

    As a training case I'm trying to build a class, in VB.NET, that will
    hold my friends names, addresses, zipcodes and cities, emails, like
    this:

    Public Class ContaktsData

    Public fName As String
    Public lName As String
    Public fAdr As String
    Public fZip As String
    Public fEmail As String


    End Class

    However...Can anybody help me out with a simple example on how to build
    this class, or point me to an article that deals with this subject?

    I want to store the information from a form to a .dat file I think in
    the end.

    Me.Name

  • _AnonCoward

    #2
    Re: Help with class


    <gsb58@hotmail. com> wrote in message
    news:1126242352 .070944.128110@ z14g2000cwz.goo glegroups.com.. .
    :
    : Hi!
    :
    : As a training case I'm trying to build a class, in VB.NET, that will
    : hold my friends names, addresses, zipcodes and cities, emails, like
    : this:
    :
    : Public Class ContaktsData
    :
    : Public fName As String
    : Public lName As String
    : Public fAdr As String
    : Public fZip As String
    : Public fEmail As String
    :
    :
    : End Class
    :
    : However...Can anybody help me out with a simple example on how to
    : build this class, or point me to an article that deals with this
    : subject?
    :
    : I want to store the information from a form to a .dat file I think
    : in the end.
    :
    : Me.Name


    You've got a good start. Don't make the fields public however - access
    then via properties. For example:

    Public Property FirstName() As String
    Get
    Return fName
    End Get
    Set
    fName = value
    End Set
    End Property


    Secondly, you'll want a collection of the contacts. One approach would
    be to reference the System.Collecti ons namespace and declare a class
    that inherits from CollectionBase (see the SDK documentation for an
    example of how to implement this).


    You'll also want some way of reading in the data as well as saving it
    when you're done. So in addition to the logic needed to flesh out the
    CollectionBase derived class, you'll probably want some functions to
    load the existing data and save the new data from and to your .dat file.


    Finally, create an application that will provide you with a way of
    actually putting this class to work.


    I hope this is what you were looking for. Good luck and have fun.


    Ralf
    --
    ----------------------------------------------------------
    * ^~^ ^~^ *
    * _ {~ ~} {~ ~} _ *
    * /_``>*< >*<''_\ *
    * (\--_)++) (++(_--/) *
    ----------------------------------------------------------
    There are no advanced students in Aikido - there are only
    competent beginners. There are no advanced techniques -
    only the correct application of basic principles.


    Comment

    • gsb58@hotmail.com

      #3
      Re: Help with class

      Thanks Ralf!

      I'll check the documentation.

      This helps me on the way.

      Me.Name

      Comment

      Working...