Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Property Grid
  New Posts New Posts RSS Feed - How to use AddChildItemBinded in C#?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to use AddChildItemBinded in C#?

 Post Reply Post Reply
Author
Message
leojay View Drop Down
Groupie
Groupie


Joined: 07 March 2005
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote leojay Quote  Post ReplyReply Direct Link To This Post Topic: How to use AddChildItemBinded in C#?
    Posted: 19 May 2008 at 12:03am
I'm using c#.

I define a field named nData, and a property named Data like this:
        private int nData = 0;
        public int Data
        {
            get { return nData; }
            set
            {
                nData = value;
                System.Diagnostics.Debug.WriteLine(nData);
            }
        }


in the Form_Load function:
            XtremePropertyGrid.PropertyGridItem root = PropertyGrid.AddCategory("a");
            root.AddChildItemBinded(XtremePropertyGrid.PropertyItemType.PropertyItemNumber, this, "nData");


but the second line of the Form_Load code snippet throws an InvalidCastException, and says "Specified cast is not valid".

if  i change the third parameter of the second line to "Data", I still get the same error.

so, my question is, is it possible to use AddChildItemBinded in C#?
If it's possible, any sample available?

thanks.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2008 at 1:35am
Hi,
 
Just tried with vc2002 and vc2008 - your code works.
 
Can you modify our sample and attach it here.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
leojay View Drop Down
Groupie
Groupie


Joined: 07 March 2005
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote leojay Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2008 at 3:27am
you can get my project here:
http://python.leojay.googlepages.com/pgtest.zip

it's strange that, in your PropertyGrid sample, my code works.
but in a new project, it doesn't.
i don't know why. :(
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2008 at 3:17am
Hi,
 
Change this:
 
Properties->Application-> Assembly Information:
Click Checkbox "Make assembly COM-Visible"
 
and instead of "nData" specify public "Data"
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
leojay View Drop Down
Groupie
Groupie


Joined: 07 March 2005
Status: Offline
Points: 27
Post Options Post Options   Thanks (0) Thanks(0)   Quote leojay Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2008 at 4:02am
thanks, that works.

is it possible to add some specific description in the thrown exception?
"Specified cast is not valid" is really not a good hint.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2008 at 8:11am
Hi,
 
its .NET description not our :)
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.