let and get

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • WindAndWaves

    #1

    let and get

    Can anyone explain me the joy of let and get. Once more, I read the
    explanation in the help, but did not get much wiser.

    I seem to learn best from examples, but I did not come across any good
    ones...

    Thank you Nicolaas


    ---
    Please immediately let us know (by phone or return email) if (a) this email
    contains a virus
    (b) you are not the intended recipient
    (c) you consider this email to be spam.
    We have done our utmost to make sure that
    none of the above are applicable. THANK YOU
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004


  • Douglas J. Steele

    #2
    Re: let and get

    Let is how you set the value of a property of a class, Get is how you pass
    the value back.

    In your class, you'd have something like:

    Private mstrBlah As String

    Public Property Let Blah(Value As String)
    mstrBlah = Value
    End Property

    Public Property Get Blah() As String
    Blah = mstrBlah
    End Property

    Then, in your code that's instantiated an instance of MyClass, you'd have
    something like:

    MyClass.Blah = "zxy"

    to call the Let property to assign a value for Blah to the instance of the
    class, and

    strBlah = MyClass.Blah

    to call the Get property to retrieve that value.

    --
    Doug Steele, Microsoft Access MVP

    (no e-mails, please!)


    "WindAndWav es" <access@ngaru.c om> wrote in message
    news:Ooysc.9732 $XI4.348553@new s.xtra.co.nz...[color=blue]
    > Can anyone explain me the joy of let and get. Once more, I read the
    > explanation in the help, but did not get much wiser.
    >
    > I seem to learn best from examples, but I did not come across any good
    > ones...
    >
    > Thank you Nicolaas
    >
    >
    > ---
    > Please immediately let us know (by phone or return email) if (a) this[/color]
    email[color=blue]
    > contains a virus
    > (b) you are not the intended recipient
    > (c) you consider this email to be spam.
    > We have done our utmost to make sure that
    > none of the above are applicable. THANK YOU
    > Checked by AVG anti-virus system (http://www.grisoft.com).
    > Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004
    >
    >[/color]


    Comment

    • Douglas J. Steele

      #3
      Re: let and get

      Let is how you set the value of a property of a class, Get is how you pass
      the value back.

      In your class, you'd have something like:

      Private mstrBlah As String

      Public Property Let Blah(Value As String)
      mstrBlah = Value
      End Property

      Public Property Get Blah() As String
      Blah = mstrBlah
      End Property

      Then, in your code that's instantiated an instance of MyClass, you'd have
      something like:

      MyClass.Blah = "zxy"

      to call the Let property to assign a value for Blah to the instance of the
      class, and

      strBlah = MyClass.Blah

      to call the Get property to retrieve that value.

      --
      Doug Steele, Microsoft Access MVP

      (no e-mails, please!)


      "WindAndWav es" <access@ngaru.c om> wrote in message
      news:Ooysc.9732 $XI4.348553@new s.xtra.co.nz...[color=blue]
      > Can anyone explain me the joy of let and get. Once more, I read the
      > explanation in the help, but did not get much wiser.
      >
      > I seem to learn best from examples, but I did not come across any good
      > ones...
      >
      > Thank you Nicolaas
      >
      >
      > ---
      > Please immediately let us know (by phone or return email) if (a) this[/color]
      email[color=blue]
      > contains a virus
      > (b) you are not the intended recipient
      > (c) you consider this email to be spam.
      > We have done our utmost to make sure that
      > none of the above are applicable. THANK YOU
      > Checked by AVG anti-virus system (http://www.grisoft.com).
      > Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004
      >
      >[/color]


      Comment

      • WindAndWaves

        #4
        Re: let and get

        Dear Doug

        I read your email a couple of times to understand it all and I think I do.
        However, what I do not understand is the big picture. I worked out, it is
        similar to for example

        Frm.Caption = "Input form" as a let statement

        and Str = Frm.Caption as a get statement

        but when and how do you use this sort of stuff and where, how and for how
        long does access store the value???

        I hope this does not sound stupid or ignorant.

        Thank you

        Nicolaas




        "Douglas J. Steele" <NOSPAM_djsteel e@NOSPAM_canada .com> wrote in message
        news:mRFsc.1274 $Sjc1.1049@news 01.bloor.is.net .cable.rogers.c om...[color=blue]
        > Let is how you set the value of a property of a class, Get is how you pass
        > the value back.
        >
        > In your class, you'd have something like:
        >
        > Private mstrBlah As String
        >
        > Public Property Let Blah(Value As String)
        > mstrBlah = Value
        > End Property
        >
        > Public Property Get Blah() As String
        > Blah = mstrBlah
        > End Property
        >
        > Then, in your code that's instantiated an instance of MyClass, you'd have
        > something like:
        >
        > MyClass.Blah = "zxy"
        >
        > to call the Let property to assign a value for Blah to the instance of the
        > class, and
        >
        > strBlah = MyClass.Blah
        >
        > to call the Get property to retrieve that value.
        >
        > --
        > Doug Steele, Microsoft Access MVP
        > http://I.Am/DougSteele
        > (no e-mails, please!)
        >
        >
        > "WindAndWav es" <access@ngaru.c om> wrote in message
        > news:Ooysc.9732 $XI4.348553@new s.xtra.co.nz...[color=green]
        > > Can anyone explain me the joy of let and get. Once more, I read the
        > > explanation in the help, but did not get much wiser.
        > >
        > > I seem to learn best from examples, but I did not come across any good
        > > ones...
        > >
        > > Thank you Nicolaas
        > >
        > >
        > > ---
        > > Please immediately let us know (by phone or return email) if (a) this[/color]
        > email[color=green]
        > > contains a virus
        > > (b) you are not the intended recipient
        > > (c) you consider this email to be spam.
        > > We have done our utmost to make sure that
        > > none of the above are applicable. THANK YOU
        > > Checked by AVG anti-virus system (http://www.grisoft.com).
        > > Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004
        > >
        > >[/color]
        >
        >[/color]


        ---
        Please immediately let us know (by phone or return email) if (a) this email
        contains a virus
        (b) you are not the intended recipient
        (c) you consider this email to be spam.
        We have done our utmost to make sure that
        none of the above are applicable. THANK YOU
        Checked by AVG anti-virus system (http://www.grisoft.com).
        Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004


        Comment

        • Douglas J. Steele

          #5
          Re: let and get

          This is done in conjunction with classes. You've got another fairly lengthy
          thread about classes in this newsgroup that hopefully explains what a class
          is and when you'd use it.

          When you assign a value to a instantiated class, that value should last for
          as long as the class remains instantiated.

          --
          Doug Steele, Microsoft Access MVP

          (no e-mails, please!)


          "WindAndWav es" <access@ngaru.c om> wrote in message
          news:q3Qsc.1008 4$XI4.365057@ne ws.xtra.co.nz.. .[color=blue]
          > Dear Doug
          >
          > I read your email a couple of times to understand it all and I think I do.
          > However, what I do not understand is the big picture. I worked out, it is
          > similar to for example
          >
          > Frm.Caption = "Input form" as a let statement
          >
          > and Str = Frm.Caption as a get statement
          >
          > but when and how do you use this sort of stuff and where, how and for how
          > long does access store the value???
          >
          > I hope this does not sound stupid or ignorant.
          >
          > Thank you
          >
          > Nicolaas
          >
          >
          >
          >
          > "Douglas J. Steele" <NOSPAM_djsteel e@NOSPAM_canada .com> wrote in message
          > news:mRFsc.1274 $Sjc1.1049@news 01.bloor.is.net .cable.rogers.c om...[color=green]
          > > Let is how you set the value of a property of a class, Get is how you[/color][/color]
          pass[color=blue][color=green]
          > > the value back.
          > >
          > > In your class, you'd have something like:
          > >
          > > Private mstrBlah As String
          > >
          > > Public Property Let Blah(Value As String)
          > > mstrBlah = Value
          > > End Property
          > >
          > > Public Property Get Blah() As String
          > > Blah = mstrBlah
          > > End Property
          > >
          > > Then, in your code that's instantiated an instance of MyClass, you'd[/color][/color]
          have[color=blue][color=green]
          > > something like:
          > >
          > > MyClass.Blah = "zxy"
          > >
          > > to call the Let property to assign a value for Blah to the instance of[/color][/color]
          the[color=blue][color=green]
          > > class, and
          > >
          > > strBlah = MyClass.Blah
          > >
          > > to call the Get property to retrieve that value.
          > >
          > > --
          > > Doug Steele, Microsoft Access MVP
          > > http://I.Am/DougSteele
          > > (no e-mails, please!)
          > >
          > >
          > > "WindAndWav es" <access@ngaru.c om> wrote in message
          > > news:Ooysc.9732 $XI4.348553@new s.xtra.co.nz...[color=darkred]
          > > > Can anyone explain me the joy of let and get. Once more, I read the
          > > > explanation in the help, but did not get much wiser.
          > > >
          > > > I seem to learn best from examples, but I did not come across any good
          > > > ones...
          > > >
          > > > Thank you Nicolaas
          > > >
          > > >
          > > > ---
          > > > Please immediately let us know (by phone or return email) if (a) this[/color]
          > > email[color=darkred]
          > > > contains a virus
          > > > (b) you are not the intended recipient
          > > > (c) you consider this email to be spam.
          > > > We have done our utmost to make sure that
          > > > none of the above are applicable. THANK YOU
          > > > Checked by AVG anti-virus system (http://www.grisoft.com).
          > > > Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >
          > ---
          > Please immediately let us know (by phone or return email) if (a) this[/color]
          email[color=blue]
          > contains a virus
          > (b) you are not the intended recipient
          > (c) you consider this email to be spam.
          > We have done our utmost to make sure that
          > none of the above are applicable. THANK YOU
          > Checked by AVG anti-virus system (http://www.grisoft.com).
          > Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004
          >
          >[/color]


          Comment

          • Lyle Fairfield

            #6
            Re: let and get

            Douglas J. Steele wrote:[color=blue]
            > This is done in conjunction with classes.[/color]

            But let and get properties were enabled for standard modules in AC2K.

            Comment

            • Michael \(michka\) Kaplan [MS]

              #7
              Re: let and get

              Yes, they were -- and are a useful way to wrap global variables. But their
              primary purpose is for use in classes.


              --
              MichKa [MS]
              NLS Collation/Locale/Keyboard Development
              Globalization Infrastructure and Font Technologies

              This posting is provided "AS IS" with
              no warranties, and confers no rights.

              "Lyle Fairfield" <lylefairfield@ netscape.net> wrote in message
              news:2hichkFdj0 p2U1@uni-berlin.de...[color=blue]
              > Douglas J. Steele wrote:[color=green]
              > > This is done in conjunction with classes.[/color]
              >
              > But let and get properties were enabled for standard modules in AC2K.[/color]


              Comment

              • WindAndWaves

                #8
                Re: let and get

                another dumb question, further to this let and get discussion.

                Would it not be much easier to store values in a (temporary) table???

                this just seems a lot more tangible.


                "Michael (michka) Kaplan [MS]" <michkap@online .microsoft.com> wrote in
                message news:40b481e1@n ews.microsoft.c om...[color=blue]
                > Yes, they were -- and are a useful way to wrap global variables. But their
                > primary purpose is for use in classes.
                >
                >
                > --
                > MichKa [MS]
                > NLS Collation/Locale/Keyboard Development
                > Globalization Infrastructure and Font Technologies
                >
                > This posting is provided "AS IS" with
                > no warranties, and confers no rights.
                >
                > "Lyle Fairfield" <lylefairfield@ netscape.net> wrote in message
                > news:2hichkFdj0 p2U1@uni-berlin.de...[color=green]
                > > Douglas J. Steele wrote:[color=darkred]
                > > > This is done in conjunction with classes.[/color]
                > >
                > > But let and get properties were enabled for standard modules in AC2K.[/color]
                >
                >[/color]


                ---
                Please immediately let us know (by phone or return email) if (a) this email
                contains a virus
                (b) you are not the intended recipient
                (c) you consider this email to be spam.
                We have done our utmost to make sure that
                none of the above are applicable. THANK YOU
                Checked by AVG anti-virus system (http://www.grisoft.com).
                Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004


                Comment

                • Larry Daugherty

                  #9
                  Re: let and get

                  Hi Nicolaas,

                  The thread is incomplete so I may be missing the point of your post. Also,
                  the first part I see is a response to an email???

                  If all you want to do is store values then a table will do it better than
                  anything else. I seem to recall a thread originated by you in the last few
                  days about classes so I assume this discussion is still about that.

                  First, a confession: I've been so busy doing other things and nothing at
                  all that I haven't really gotten into classes and objects. But I do know
                  that they are great! A class module is a "cookie cutter" you design it to
                  have all of the properties and behaviors that you want the objects of that
                  class to have. You can then create any number of instances of objects (the
                  cookies). If you want to change something about the class, you change it in
                  the class module and thereafter all of the objects you create from that
                  class will have the new behavior or properties.

                  Ken Getz has included a chapter or so in the last several editions of The
                  Access [YourVersion] Developer's Handbook from Sybex. Deborah Kurata has
                  written a few books about Doing Objects in Microsoft Visual Basic
                  [YourVersion].

                  Storage is more of an issue than you might have imagined. Variable
                  information that must persist across sessions must be stored in a file or
                  table.

                  To directly address your question about Let and Get: You can validate the
                  argument passed in with the let and be sure it fits your paradigm. You can
                  also have the Let initiate some other process inside your object which would
                  be beyond the capabilities of an Access table. The same is true of the Get.
                  Also, you are not making the actual variables visible to the using program,
                  only the properties via your code.

                  There are snippets of information available all over the internet but I
                  recommend going for a good book first.

                  HTH
                  --
                  -Larry-
                  --

                  "WindAndWav es" <access@ngaru.c om> wrote in message
                  news:Cw8tc.1053 9$XI4.381611@ne ws.xtra.co.nz.. .[color=blue]
                  > another dumb question, further to this let and get discussion.
                  >
                  > Would it not be much easier to store values in a (temporary) table???
                  >
                  > this just seems a lot more tangible.
                  >
                  >
                  > "Michael (michka) Kaplan [MS]" <michkap@online .microsoft.com> wrote in
                  > message news:40b481e1@n ews.microsoft.c om...[color=green]
                  > > Yes, they were -- and are a useful way to wrap global variables. But[/color][/color]
                  their[color=blue][color=green]
                  > > primary purpose is for use in classes.
                  > >
                  > >
                  > > --
                  > > MichKa [MS]
                  > > NLS Collation/Locale/Keyboard Development
                  > > Globalization Infrastructure and Font Technologies
                  > >
                  > > This posting is provided "AS IS" with
                  > > no warranties, and confers no rights.
                  > >
                  > > "Lyle Fairfield" <lylefairfield@ netscape.net> wrote in message
                  > > news:2hichkFdj0 p2U1@uni-berlin.de...[color=darkred]
                  > > > Douglas J. Steele wrote:
                  > > > > This is done in conjunction with classes.
                  > > >
                  > > > But let and get properties were enabled for standard modules in AC2K.[/color]
                  > >
                  > >[/color]
                  >
                  >
                  > ---
                  > Please immediately let us know (by phone or return email) if (a) this[/color]
                  email[color=blue]
                  > contains a virus
                  > (b) you are not the intended recipient
                  > (c) you consider this email to be spam.
                  > We have done our utmost to make sure that
                  > none of the above are applicable. THANK YOU
                  > Checked by AVG anti-virus system (http://www.grisoft.com).
                  > Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004
                  >
                  >[/color]


                  Comment

                  • WindAndWaves

                    #10
                    Re: let and get

                    Dear All,

                    I have really been doing a lot of reading here, thank you so much for all
                    your replies.

                    I know finally really understand this "let set get class module thing."
                    Great

                    Although I cannot really see where I should be using it, I definitely see
                    advantages. One of the biggest ones is the autocompletion (where you can
                    see all the methods and properties). That really simplifies working.

                    Thank you all once more for all your ideas.




                    ---
                    Please immediately let us know (by phone or return email) if (a) this email
                    contains a virus
                    (b) you are not the intended recipient
                    (c) you consider this email to be spam.
                    We have done our utmost to make sure that
                    none of the above are applicable. THANK YOU
                    Checked by AVG anti-virus system (http://www.grisoft.com).
                    Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004


                    Comment

                    Working...