Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello,

 

I created a custom control which consists of a label and a listbox. The control has to have a public property called 'Items' which allows users to add list items to the control's listbox during design time. (much like the Items property of the vb listbox). I used ListItemsCollectionEditor to display the ListItems Editor window.

 

I added some list items using the ListItems Editor window but the listbox did not display the newly added items at all.

 

A code snippet is given below:

 

Private listitems as new ListItemCollection

 

<EditorAttribute(GetType(System.Web.UI.Design.WebControls.ListItemsCollectionEditor), _

GetType(UITypeEditor))> _ 'displays the ListItemEditor window

Public ReadOnly Property Items() As ListItemCollection

 

Get

Return listitems

End Get

 

End Property

 

How do I let the listbox to display the newly added list items from the ItemCollection Editor window?

Advice would be appreciated :)

  • Leaders
Posted

The values are generally persisted via the AddRange function for collections, meaning that the property which returns the collection can be (and probably should be) read only. The problem is that there is a lot involved in telling a designer how to serialize data and objects. Have you looked at a tutorial on using designers for collections?

 

You might find these tutorials to be educational. They might not address your question directly, but they should give you insight into the world of .Net designers and help you find a solution.

http://www.xtremedotnettalk.com/showthread.php?t=70318

http://www.xtremedotnettalk.com/showthread.php?t=70320

[sIGPIC]e[/sIGPIC]
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...