Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all,

 

in my class I declared a string-array property with the attributes to show it on PropertyGrid:

 

<CategoryAttribute("Aspect"), _

Browsable(True), _

DescriptionAttribute("Insert text"), _

XmlAttributeAttribute()> _

Property StringPointer() As String()

Get

Return m_StringList

End Get

Set(ByVal Value() As String)

Text = Value(0)

m_StringList = DirectCast(Value.Clone, String())

End Set

End Property

 

It works but the PropertyGrid allows to modify the strings in two ways:

1. through the default String Editor that appear clicking the StringPointer property on the Grid and

2. each single string if you expand the property clicking on the 'plus' symbol.

 

 

Now, because the whole array is the property, this last way doesn't reflect on the form that shows the strings.

Is there a way to simply prevent the second way?

 

Thanks for the attention.

Posted

I reply to myself, I think this will be useful...

 

I added a new attribute

 

<TypeConverter(GetType(CollectionConverter)), _

 

above the property definition and now there's just one way to modify the property by the PropertyGrid i.e. the string editor.

I don't know if this is the best solution but it works.

 

Any suggestion?

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...