Professional Web Applications Themes

Class Modules Question - ASP Components

Gday :) I have a DLL project which calls data via ADO and exposes the various fields as Property(s). I'm getting a comile error: ------------------ Compile Error: Definitions of property procedures for the same property are inconsistent, or property procedure has an optional parameter, a ParamArray, or an invalid Set final parameter. ------------------ Private pvStreetAddress As Variant 'internal value ....... .... Property Let StreetAddress(TheValue As Variant) pvStreetAddress = TheValue End Property ....... .... Property Get StreetAddress(ReturnAs As OutputFormat) As Variant If Not IsNull(pvStreetAddress) And pvStreetAddress Is Not Empty Then StreetAddress = pvStreetAddress Else StreetAddress = Formatted(rstAddresses("StreetAddress"), ReturnAs) End If End ...

  1. #1

    Default Class Modules Question

    Gday :)

    I have a DLL project which calls data via ADO and exposes the various fields
    as Property(s).

    I'm getting a comile error:

    ------------------
    Compile Error:
    Definitions of property procedures for the same property are inconsistent,
    or property procedure has an optional parameter, a ParamArray, or an invalid
    Set final parameter.
    ------------------


    Private pvStreetAddress As Variant 'internal value

    .......
    ....

    Property Let StreetAddress(TheValue As Variant)
    pvStreetAddress = TheValue
    End Property

    .......
    ....

    Property Get StreetAddress(ReturnAs As OutputFormat) As Variant
    If Not IsNull(pvStreetAddress) And pvStreetAddress Is Not Empty Then
    StreetAddress = pvStreetAddress
    Else
    StreetAddress = Formatted(rstAddresses("StreetAddress"), ReturnAs)
    End If
    End Property

    Note:
    'Formatted' is a custom function that outputs the result in the desired
    format.
    'OutputFormat' is a Public Enum

    I'd like to allow the StreetAddress to be read (as from the DB), AND allow
    it
    to be modified before issuing an 'Addresses.Save' call (which encapsulates
    ADO.Recordset.Update). I am hoping to substantially reduce the (ASP)
    interface maintenance aspect of this project by implementing a better OO
    approach.

    This DLL (and several(!) more like it) will end up being a middle tier in an
    ASP environment.

    Thanks,
    Douglas



    "Bob Butler" <tiredofitnospam.com> wrote in message
    news:%23V9HOwlGEHA.1272TK2MSFTNGP12.phx.gbl...
    > "Douglas" <johncitizen.com> wrote in message news:40705d5dsl-news.
    > > Gday,
    > >
    > > Is there a preferred newsgroup for the discussion of Class Modules ?
    >
    > This is probably as good a place as any
    >
    > > Additionally, is there a 'ten commandments of Class Modules' floating
    > > about ?
    >
    > not that I know of... classes are probably the best improvement made to VB
    > since they added database connections. Do you have specific questions
    about
    > them?
    >
    > --
    > Reply to the group so all can participate
    > VB.Net... just say "No"
    >


    Douglas Guest

  2. #2

    Default Re: Class Modules Question

    From the MSDN library:

    "The parameters for Property Get, Property Let, and Property Set procedures
    for the same property must match exactly, except that the Property Let has
    one extra parameter, whose type must match the return type of the
    corresponding Property Get, and the Property Set has one more parameter than
    the corresponding Property Get, whose type is either Variant, Object, a
    class name, or an object library type specified in an object library."

    If you want the user to be able to format the return value from "Get
    StreetAddress", why not just make the Formatted function public, so instead
    of

    <obj>.StreetAddress(<OutputFormat>)

    ....the user could type

    <obj>.Formatted(<obj>.StreetAddress)


    --
    Björn Holmgren
    Guide Konsult AB

    "Douglas" <post.to.the.groupso.everyone.can.learn.com.au> wrote in message
    news:40711411$0$27646$61ce578dnews.syd.swiftdsl.c om.au...
    > Gday :)
    >
    > I have a DLL project which calls data via ADO and exposes the various
    fields
    > as Property(s).
    >
    > I'm getting a comile error:
    >
    > ------------------
    > Compile Error:
    > Definitions of property procedures for the same property are inconsistent,
    > or property procedure has an optional parameter, a ParamArray, or an
    invalid
    > Set final parameter.
    > ------------------
    >
    >
    > Private pvStreetAddress As Variant 'internal value
    >
    > ......
    > ...
    >
    > Property Let StreetAddress(TheValue As Variant)
    > pvStreetAddress = TheValue
    > End Property
    >
    > ......
    > ...
    >
    > Property Get StreetAddress(ReturnAs As OutputFormat) As Variant
    > If Not IsNull(pvStreetAddress) And pvStreetAddress Is Not Empty Then
    > StreetAddress = pvStreetAddress
    > Else
    > StreetAddress = Formatted(rstAddresses("StreetAddress"), ReturnAs)
    > End If
    > End Property
    >
    > Note:
    > 'Formatted' is a custom function that outputs the result in the desired
    > format.
    > 'OutputFormat' is a Public Enum
    >
    > I'd like to allow the StreetAddress to be read (as from the DB), AND allow
    > it
    > to be modified before issuing an 'Addresses.Save' call (which encapsulates
    > ADO.Recordset.Update). I am hoping to substantially reduce the (ASP)
    > interface maintenance aspect of this project by implementing a better OO
    > approach.
    >
    > This DLL (and several(!) more like it) will end up being a middle tier in
    an
    > ASP environment.
    >
    > Thanks,
    > Douglas
    >
    >
    >
    > "Bob Butler" <tiredofitnospam.com> wrote in message
    > news:%23V9HOwlGEHA.1272TK2MSFTNGP12.phx.gbl...
    > > "Douglas" <johncitizen.com> wrote in message news:40705d5dsl-news.
    > > > Gday,
    > > >
    > > > Is there a preferred newsgroup for the discussion of Class Modules ?
    > >
    > > This is probably as good a place as any
    > >
    > > > Additionally, is there a 'ten commandments of Class Modules' floating
    > > > about ?
    > >
    > > not that I know of... classes are probably the best improvement made to
    VB
    > > since they added database connections. Do you have specific questions
    > about
    > > them?
    > >
    > > --
    > > Reply to the group so all can participate
    > > VB.Net... just say "No"
    > >
    >
    >
    >

    Björn Holmgren Guest

  3. #3

    Default Re: Class Modules Question

    der fred... silly me =8P

    looking back i'm not quite sure why i did it that way in the first place,
    although it might have something to do with my inexperience with error
    handling nulls in a class module...

    Thanks Björn
    -Douglas



    "Björn Holmgren" <bjoholhotmail.com> wrote in message
    news:z49cc.36316$zm5.15272nntpserver.swip.net...
    > From the MSDN library:
    >
    > "The parameters for Property Get, Property Let, and Property Set
    procedures
    > for the same property must match exactly, except that the Property Let has
    > one extra parameter, whose type must match the return type of the
    > corresponding Property Get, and the Property Set has one more parameter
    than
    > the corresponding Property Get, whose type is either Variant, Object, a
    > class name, or an object library type specified in an object library."
    >
    > If you want the user to be able to format the return value from "Get
    > StreetAddress", why not just make the Formatted function public, so
    instead
    > of
    >
    > <obj>.StreetAddress(<OutputFormat>)
    >
    > ...the user could type
    >
    > <obj>.Formatted(<obj>.StreetAddress)
    >
    >
    > --
    > Björn Holmgren
    > Guide Konsult AB
    >
    > "Douglas" <post.to.the.groupso.everyone.can.learn.com.au> wrote in
    message
    > news:40711411$0$27646$61ce578dnews.syd.swiftdsl.c om.au...
    > > Gday :)
    > >
    > > I have a DLL project which calls data via ADO and exposes the various
    > fields
    > > as Property(s).
    > >
    > > I'm getting a comile error:
    > >
    > > ------------------
    > > Compile Error:
    > > Definitions of property procedures for the same property are
    inconsistent,
    > > or property procedure has an optional parameter, a ParamArray, or an
    > invalid
    > > Set final parameter.
    > > ------------------
    > >
    > >
    > > Private pvStreetAddress As Variant 'internal value
    > >
    > > ......
    > > ...
    > >
    > > Property Let StreetAddress(TheValue As Variant)
    > > pvStreetAddress = TheValue
    > > End Property
    > >
    > > ......
    > > ...
    > >
    > > Property Get StreetAddress(ReturnAs As OutputFormat) As Variant
    > > If Not IsNull(pvStreetAddress) And pvStreetAddress Is Not Empty Then
    > > StreetAddress = pvStreetAddress
    > > Else
    > > StreetAddress = Formatted(rstAddresses("StreetAddress"),
    ReturnAs)
    > > End If
    > > End Property
    > >
    > > Note:
    > > 'Formatted' is a custom function that outputs the result in the desired
    > > format.
    > > 'OutputFormat' is a Public Enum
    > >
    > > I'd like to allow the StreetAddress to be read (as from the DB), AND
    allow
    > > it
    > > to be modified before issuing an 'Addresses.Save' call (which
    encapsulates
    > > ADO.Recordset.Update). I am hoping to substantially reduce the (ASP)
    > > interface maintenance aspect of this project by implementing a better OO
    > > approach.
    > >
    > > This DLL (and several(!) more like it) will end up being a middle tier
    in
    > an
    > > ASP environment.
    > >
    > > Thanks,
    > > Douglas
    > >
    > >
    > >
    > > "Bob Butler" <tiredofitnospam.com> wrote in message
    > > news:%23V9HOwlGEHA.1272TK2MSFTNGP12.phx.gbl...
    > > > "Douglas" <johncitizen.com> wrote in message news:40705d5dsl-news.
    > > > > Gday,
    > > > >
    > > > > Is there a preferred newsgroup for the discussion of Class Modules ?
    > > >
    > > > This is probably as good a place as any
    > > >
    > > > > Additionally, is there a 'ten commandments of Class Modules'
    floating
    > > > > about ?
    > > >
    > > > not that I know of... classes are probably the best improvement made
    to
    > VB
    > > > since they added database connections. Do you have specific questions
    > > about
    > > > them?
    > > >
    > > > --
    > > > Reply to the group so all can participate
    > > > VB.Net... just say "No"
    > > >
    > >
    > >
    > >
    >
    >

    Douglas Guest

Similar Threads

  1. Replies: 31
    Last Post: September 29th, 08:18 AM
  2. Question about building modules on W2K
    By corn29@ no_spam excite.com in forum PERL Modules
    Replies: 9
    Last Post: September 26th, 12:28 AM
  3. Replies: 1
    Last Post: May 22nd, 04:18 PM
  4. Multiple class modules defined within a single vb activex dll
    By mike watkins in forum ASP Components
    Replies: 0
    Last Post: October 10th, 10:38 AM
  5. Modules Question
    By James Edward Gray II in forum PERL Beginners
    Replies: 2
    Last Post: September 11th, 12:51 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139