Click here to Skip to main content
15,903,175 members

Comments by Member 11700078 (Top 6 by date)

Member 11700078 3-Feb-21 13:49pm View    
ItemsCollection instance means New ItemsCollection and that is in my user control level. I mentioned earlier that my User Control is having a Property Called 'Items' As ItemsCollection. Codes are like this <designerserializationvisibility(designerserializationvisibility.content), category("data"),="" description("items="" in="" the="" combo="" box.")=""> _
<editor("system.windows.forms.design.stringcollectioneditor, system.design",="" "system.drawing.design.uitypeeditor,="" system.drawing")=""> _
Public ReadOnly Property Items() As ItemsCollection 'System.Collections.Specialized.StringCollection
Get
Return P1Value
End Get
End Property
Dim P1Value As New ItemsCollection. So I think ItemsCollection instance is in the user control level. if Items' Count property changes or items are cleared accordingly clear all the Labels Texts or if Items Count become 1 only first label will be texted. I think, it doesn't make any difference, collectionChanged or PropertyChanged as long as my user control gets the value of count property of Items property. A ComboBox is best example, during run time if I Execute Me.ComboBox1.Items.Clear(), it removes all the entries of the ComboBox. Same thing I want to do. Thanks and Regards.
Member 11700078 3-Feb-21 11:06am View    
Thanks a lot Mr. Richard Deeming,
As per your suggestion I remove the implementation of INotifyPropertyChnaged. I am still getting the Event. But with this my problem is not solved. I used this collection class in my User control's Items Property. I need, need to transfer this event in user control level so that the Labels' texts are update as per Items.Count.
Suggest me how do I get the Event in User Control level. Or if I implement INotifyPropertyChanged in User Control level, and any change in user control's 'Items property', will it trigger the event. Suggest what shall I do. Thanks. Regards.
Member 11700078 1-Feb-21 0:35am View    
Dear Gerry Schmitz, Thanks for the suggestion. I have not inherited CB, I wanted to create it from scratch. For learning purpose only. New, Please help me if you can.
My user control is having a property Items() as System.Collections.Specialized.StringCollection. This collection is having methods like Add(), Clear() etc. If I add a string the Count property increases by one, if I use Clear(), count become zero. How my control will come to know that count has changed. Can I add a new Event CountChanged() . Please help me in this. Regards.
Member 11700078 31-Jan-21 16:55pm View    
Thanks a lot Mr. Maciej Los for the guidance.

I have some more doubts.

I have added the user control on a form. In the design mode of the form, the user control is having the property 'Items' in the property grid. on clicking the eclipse the collection editor pops up, I added three lines. During run mode of the Form my user control shows the three lines (Items). I have added on Button on the form, behind the Button I wrote "MyControl.Items.Clear()". this should clear all the three items. but this is not happening. This will not happen because I have not written any code for this to happen. I don't know what to write and where to write. Similarly I tried to add new item, it is not adding. You have suggested "YourUserControlInstance.Items.Add("new Item")" when is mycontrol's instance, in the load event of the user control or at the Form level ? I am confused, please guide me.
Methods of String Collection Like 'Clear()', 'Add()' works automatically ? Please see that the Property is "Public ReadOnly Property Items() As System.Collections.Specialized.StringCollection"
Regards.
Member 11700078 18-Jan-21 10:30am View    
Thanks a lot this is working fine.