473,324 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

PropertyGrid - can't edit property

Hi

I have a main class with a public property of type sub class, which
has several properties of type int.

When i assign an instance of my main class to
propertyGrid.SelectedObject I cannot edit values for the properties of
my sub class, I can't even expand it (I was expecting to see the
little + sign next to it, to expand the int properties). Can anyone
tell me how to do this please.

Many thanks
Julia.

May 11 '07 #1
3 3580
Add [TypeConverter(typeof(ExpandableObjectConverter))] to either the
class definition or the property definition.Or look into the sub-
property support if you already have your own custom TypeConverter.

http://www.bluevisionsoftware.com/We...bjectConverter

Marc

May 11 '07 #2
I had looked in to this, and below is my implementation, which still
doesn't work. What else am i missing?

Many thanks
Julia.

public class Class1
{
private MySize m_size;

public MySize Size
{
get
{
return m_size;
}
set
{
m_size = value;
}
}
}

[TypeConverter(typeof(ExpandableObjectConverter))]
public class MySize
{
private int m_x;
private int m_y;

public int X
{
get
{
return m_x;
}
set
{
m_x = value;
}
}
public int Y
{
get
{
return m_y;
}
set
{
m_y = value;
}
}
}

May 14 '07 #3
What else am i missing?
obj.Size = new Size();

The Size is null; depending on the scenario, it may be prudent for the
Class1 ctor to create a Size, perhaps as "readonly". If the Size is
immutable (common if it is a struct, which "Size" often is), then note
that the converter can still support editing sub-properties via
CreateInstance() [can explain if needed]. Likewise, if you want the
user to be able to edit the Size string directly
(rather/in-addition-to than the sub-properties), then your converter
must support ConvertFrom for string.

Marc
May 14 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Brent White | last post by:
Pardon my ignorance if it exists, but I'm trying to upgrade from VB 6 to VS.NET 2005 and have a problem. I created an ASPX file with the corresponding ASPX.VB file, but when I try to edit the...
3
by: Richard Coutts | last post by:
I have a query created by the "Find Unmatched" query that lists items in a table that were not selected by another query. The Query does what it needs to do, but I can't edit any of the resulting...
2
by: mwhalen | last post by:
Hi All, I've dynmaically created a textbox, but I can't edit it. When I click on it, the cursor flashes for a second, but then goes away and I can't enter any text or do anything with the value...
12
by: dennist685 | last post by:
Can't edit, delete or add row in an Access database in a website 2003 When I implement a walkthrough using Northwind I have no trouble doing this. Also, in a windowsforms project I have no...
0
by: Brett Romero | last post by:
I can edit XML files fine on my work machine but not the home machine. They are both running WinXP Pro with VS.NET 2005 final. On the home machine, content in an XML or XSL file is highlighted. ...
2
by: Steve Barnett | last post by:
I have a field in a user control which is a structure. The structure has three fields, an integer a string and a Boolean. When I put my user control on a form, the property that references the...
1
by: ortega.rad | last post by:
I have a form which allows you to select a record. That record has other records asscociated with it via a table. The asscociated records of the record selected on the main form are shown in a...
4
by: Sanchit | last post by:
I want to know thta how can i edit a file in C++ For Example my file is Mr XyZ FFFFFF 65 And now i want go change this number 65 to 87.... how can i Do this..... I...
1
by: jwlevan | last post by:
I have a small database that I use for some data tracking/record keeping. I was able to edit everything in MS Access 2000. Once i upgraded to 2003, i can't edit anything now. The database opens...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.