passing data sets between objects

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

    passing data sets between objects

    What is the best way to pass a data set between objects? I have a custom
    control which will depend on a dataset (kind of like a bound contorl, but im
    handleing it differently) is it best to pass as a public variable or a
    property? since a property only retrieves By value, and not by reference,
    when you send a data set in does it make a copy of it for that object? or
    just pass a reference similar to what an array would do in C++. What i need
    to do is pass the data set to the custom control, do some updateing on the
    data there then have it available for the application behind the contorl
    (the parent form). Whats the best way to achieve this? thanks


  • NM

    #2
    Re: passing data sets between objects

    You have the choice :

    1) if you declare a private dataset and a property that don't do anything
    else than returning and affecting the value like this :

    Private _mydata as dataset

    Public property mydata() As dataset
    set (value as dataset)
    _mydata = value
    end set
    get
    return _mydata
    end get
    end property

    You should better use a public value, because a dataset uses a lot of
    ressources and you have to use a simple access to your data instead of
    calling a method for getting a copy of your value that you'll change after;

    2) But if changing your dataset will modify something else in your class;
    use properties e.g :

    Public property mydata() As dataset
    set (value as dataset)
    _mydata = value
    ' call a method or function
    end set
    ....


    hope my answer help you;


    "Brian Henry" <brianiup[nospam]@adelphia.net> a écrit dans le message de
    news:u2L17GLHEH A.712@tk2msftng p13.phx.gbl...[color=blue]
    > What is the best way to pass a data set between objects? I have a custom
    > control which will depend on a dataset (kind of like a bound contorl, but[/color]
    im[color=blue]
    > handleing it differently) is it best to pass as a public variable or a
    > property? since a property only retrieves By value, and not by reference,
    > when you send a data set in does it make a copy of it for that object? or
    > just pass a reference similar to what an array would do in C++. What i[/color]
    need[color=blue]
    > to do is pass the data set to the custom control, do some updateing on the
    > data there then have it available for the application behind the contorl
    > (the parent form). Whats the best way to achieve this? thanks
    >
    >[/color]


    Comment

    • NM

      #3
      Re: passing data sets between objects

      You have the choice :

      1) if you declare a private dataset and a property that don't do anything
      else than returning and affecting the value like this :

      Private _mydata as dataset

      Public property mydata() As dataset
      set (value as dataset)
      _mydata = value
      end set
      get
      return _mydata
      end get
      end property

      You should better use a public value, because a dataset uses a lot of
      ressources and you have to use a simple access to your data instead of
      calling a method for getting a copy of your value that you'll change after;

      2) But if changing your dataset will modify something else in your class;
      use properties e.g :

      Public property mydata() As dataset
      set (value as dataset)
      _mydata = value
      ' call a method or function
      end set
      ....


      hope my answer help you;


      "Brian Henry" <brianiup[nospam]@adelphia.net> a écrit dans le message de
      news:u2L17GLHEH A.712@tk2msftng p13.phx.gbl...[color=blue]
      > What is the best way to pass a data set between objects? I have a custom
      > control which will depend on a dataset (kind of like a bound contorl, but[/color]
      im[color=blue]
      > handleing it differently) is it best to pass as a public variable or a
      > property? since a property only retrieves By value, and not by reference,
      > when you send a data set in does it make a copy of it for that object? or
      > just pass a reference similar to what an array would do in C++. What i[/color]
      need[color=blue]
      > to do is pass the data set to the custom control, do some updateing on the
      > data there then have it available for the application behind the contorl
      > (the parent form). Whats the best way to achieve this? thanks
      >
      >[/color]


      Comment

      • Cor

        #4
        Re: passing data sets between objects

        Hi Brian,

        What you do with a dataset is not important, you are always passing the
        reference, you do not even to return it back.

        Cor


        Comment

        • Cor

          #5
          Re: passing data sets between objects

          Hi Brian,

          What you do with a dataset is not important, you are always passing the
          reference, you do not even to return it back.

          Cor


          Comment

          • Brian Henry

            #6
            Re: passing data sets between objects

            that is what I thought, I thought it worked like a C array, where no mater
            what just passes a reference to the object in memory... thanks for verifying
            this


            "Cor" <non@non.com> wrote in message
            news:OY0DJoLHEH A.2744@TK2MSFTN GP10.phx.gbl...[color=blue]
            > Hi Brian,
            >
            > What you do with a dataset is not important, you are always passing the
            > reference, you do not even to return it back.
            >
            > Cor
            >
            >[/color]


            Comment

            • Brian Henry

              #7
              Re: passing data sets between objects

              that is what I thought, I thought it worked like a C array, where no mater
              what just passes a reference to the object in memory... thanks for verifying
              this


              "Cor" <non@non.com> wrote in message
              news:OY0DJoLHEH A.2744@TK2MSFTN GP10.phx.gbl...[color=blue]
              > Hi Brian,
              >
              > What you do with a dataset is not important, you are always passing the
              > reference, you do not even to return it back.
              >
              > Cor
              >
              >[/color]


              Comment

              Working...