
Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Yes, I created a control which inherits from ComboBox.
public class MyComboBox : ComboBox
{
...
new public AClass Items
{
get
{
return m_aclass;
}
}
...
}
I also override OnDrawItem. The problem is OnDrawItemEventArgs.Index always
= -1. In addition, at design time if I click the Items property, a dialog
comes up allowing me to add new items to my collection. I can add as many as
I want to. If I click Ok (to close the dialog) and then click the Items
property again the items I added are there. Once I run the application, the
items are no longer there. If I recheck at design time again by clicking the
Items property, the items are gone.
So I actually have 2 problems.
AClass inherits from CollectionBase.
I hope this is a little more clear.
-Joe
> Hi Joe,
>
[quoted text clipped - 12 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
"Jeffrey Tan[MSFT]" - 27 Jan 2006 08:53 GMT
Hi Itzik ,
Thanks for your feedback.
#1, No, your code simply uses a new Items property to hide the standard
ComboBox Items property. However, the combobox does not know to use this
new Items property to render its content. The standard Items property is of
type Object collection, why you can not use the existing Items property? If
you really want to hide it, you have to loop through your m_aclass
collection and add each item to base.Items property.
#2, please refer to the link below:
"56.11 How can I persist a collection of items into code?"
http://64.78.52.104/FAQ/WinForms/FAQ_c81c.asp#q713q
Hope this helps
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.