collection property and refresh control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • --== Alain ==--

    #1

    collection property and refresh control

    Hi,

    I have a control which has a collection property.
    when an item of the collection property will be added, removed, and so
    on, i would like to refresh the control itself.

    Usually for that i use eventhandler in the set method of the property.
    But as the collection property has only a get method, i'm not able to do
    it so.

    Therefore, i would like to know how can i do to refresh the parent
    control (container) of my collection property when a collection item is
    changed ?

    thanks a lot,

    Al.
  • Spam Catcher

    #2
    Re: collection property and refresh control

    --== Alain ==-- <nospam@noemail .comwrote in news:#7c6ikYVHH A.1036
    @TK2MSFTNGP03.p hx.gbl:
    I have a control which has a collection property.
    when an item of the collection property will be added, removed, and so
    on, i would like to refresh the control itself.
    >
    Usually for that i use eventhandler in the set method of the property.
    But as the collection property has only a get method, i'm not able to do
    it so.
    >
    Therefore, i would like to know how can i do to refresh the parent
    control (container) of my collection property when a collection item is
    changed ?
    If you're using .NET 2.0, take a look at the BindingSource object. If your
    controls are bound to a bindingsource object, they'll refresh
    automatically.

    Comment

    • RobinS

      #3
      Re: collection property and refresh control

      You have posted this to at least the following newsgroups.

      microsoft.publi c.dotnet.framew ork.windowsform s.controls
      microsoft.publi c.dotnet.genera l
      microsoft.publi c.dotnet.langua ges.csharp
      microsoft.publi c.dotnet.langua ges.vb

      In the future, if you feel a need to do that, please put all the groups in
      the header post them all at once. That way, if someone in one newsgroup
      provides an answer, it shows up in all of the groups you posted it in, and
      the others know they can spend their time helping someone else.

      Thanks,
      Robin S.
      "--== Alain ==--" <nospam@noemail .comwrote in message
      news:%237c6ikYV HHA.1036@TK2MSF TNGP03.phx.gbl. ..
      Hi,
      >
      I have a control which has a collection property.
      when an item of the collection property will be added, removed, and so
      on, i would like to refresh the control itself.
      >
      Usually for that i use eventhandler in the set method of the property.
      But as the collection property has only a get method, i'm not able to do
      it so.
      >
      Therefore, i would like to know how can i do to refresh the parent
      control (container) of my collection property when a collection item is
      changed ?
      >
      thanks a lot,
      >
      Al.

      Comment

      • dippykdog@gmail.com

        #4
        Re: collection property and refresh control

        Therefore, i would like to know how can i do to refresh the parent
        control (container) of my collection property when a collection item is
        changed ?
        >
        If you're using .NET 2.0, take a look at the BindingSource object. If your
        controls are bound to a bindingsource object, they'll refresh
        automatically.
        If you're not using 2.0, you can mimic binding by creating an update
        event on the item (raise this event whenever an item property is
        changed). Handle this event in the collection by raising another event
        there (e.g., ItemUpdated), and handle that event in the control. You
        could also have other events to distinguish among what's going on in
        the collection:
        ItemUpdated - when an item raises its update event
        ItemAdded - raised by collection when item is added
        ItemRemoved -...
        etc.
        The control (or whatever is using the collection) can then react with
        precision to different activities in the collection.

        Comment

        Working...