471,089 Members | 1,098 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,089 software developers and data experts.

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.
Feb 21 '07 #1
3 1392
--== Alain ==-- <no****@noemail.comwrote in news:#7c6ikYVHHA.1036
@TK2MSFTNGP03.phx.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.
Feb 21 '07 #2
You have posted this to at least the following newsgroups.

microsoft.public.dotnet.framework.windowsforms.con trols
microsoft.public.dotnet.general
microsoft.public.dotnet.languages.csharp
microsoft.public.dotnet.languages.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 ==--" <no****@noemail.comwrote in message
news:%2****************@TK2MSFTNGP03.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.

Feb 21 '07 #3
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.

Feb 21 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Kurt Bauer | last post: by
19 posts views Thread by Jamey Shuemaker | last post: by
3 posts views Thread by --== Alain ==-- | last post: by
1 post views Thread by --== Alain ==-- | last post: by
1 post views Thread by --== Alain ==-- | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.