PC Review


Reply
Thread Tools Rate Thread

collection property and refresh control

 
 
--== Alain ==--
Guest
Posts: n/a
 
      21st Feb 2007
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.
 
Reply With Quote
 
 
 
 
Spam Catcher
Guest
Posts: n/a
 
      21st Feb 2007
--== Alain ==-- <(E-Mail Removed)> wrote 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.
 
Reply With Quote
 
RobinS
Guest
Posts: n/a
 
      21st Feb 2007
You have posted this to at least the following newsgroups.

microsoft.public.dotnet.framework.windowsforms.controls
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 ==--" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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.



 
Reply With Quote
 
dippykdog@gmail.com
Guest
Posts: n/a
 
      21st Feb 2007
> > 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Collection issue to refresh control : suite --== Alain ==-- Microsoft C# .NET 0 23rd Feb 2007 07:22 PM
collection property and refresh the parent control --== Alain ==-- Microsoft Dot NET 1 21st Feb 2007 08:04 AM
Designer -> 'Collection' type property -> refresh control after adding new items 12jumper@wp.pl Microsoft C# .NET 1 10th Jan 2007 03:33 PM
Can't get collection to save when using collection of custom class as property of control in VS 2005 J.Edwards Microsoft Dot NET Compact Framework 0 10th Jan 2006 04:44 AM
Collection Property Web Custom Control Chris Calzaretta Microsoft VB .NET 0 28th Feb 2005 04:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:50 PM.