Preventing users from adding items in ArrayEditor

B

brik

I've been trying to implement a way to edit a property (containing an
Array of private objects) on a webcontrol at design-time ... my first
shot actually works quite fine; the editor shows the two objects and
i'm able to edit their content.
BUT ... I don't want the user to be able to add/delete objects in the
editor. Is there no way to prohibit this ?

My code :
public class myClass : Object
{
private int no;
public int Number { get{ return no; } set{ number = value; } }
public myClass(int aNumber) { no = aNumber; }
public override string ToString() { return no.ToString(); }
}

[...]
private myClass[] myarray = new myClass [] {new myClass (1), new
myClass (2)};

[Category("Appearance"),
PersistenceMode(PersistenceMode.Default),
EditorAttribute(typeof(System.ComponentModel.Design.ArrayEditor),
typeof(System.Drawing.Design.UITypeEditor)) ]
public myClass[] TestArray
{
get { return myarray; }
set { myarray = value; )
}
[...]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top