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

Using Property Grid in C#

 Post Reply Post Reply
Author
Message
lpereira View Drop Down
Newbie
Newbie


Joined: 21 February 2005
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote lpereira Quote  Post ReplyReply Direct Link To This Post Topic: Using Property Grid in C#
    Posted: 21 February 2005 at 4:52pm

I am using the property grid in a c#application. I need to be able to validate data that a user enters for a propertygrid item and then notify the user if its invalid data. I added the valuechanged event to my code, however there is no way to identify which item was the one modified. Is there a way to do this?

Thanks.

Back to Top
Boyd View Drop Down
Senior Member
Senior Member


Joined: 08 December 2003
Location: United States
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boyd Quote  Post ReplyReply Direct Link To This Post Posted: 21 February 2005 at 6:39pm
I don't have the documents in front of me right now, but I believe the EventArgs for the 'ValueChanged' event will include a reference to the item that was modified.
Back to Top
ianp View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 19 December 2003
Location: United Kingdom
Status: Offline
Points: 119
Post Options Post Options   Thanks (0) Thanks(0)   Quote ianp Quote  Post ReplyReply Direct Link To This Post Posted: 22 February 2005 at 3:27am

The ValueChanged event in VB6 should be:

Private Sub PropertyGrid1_ValueChanged(ByVal Item As XtremePropertyGrid.IPropertyGridItem)

End Sub

Back to Top
Boyd View Drop Down
Senior Member
Senior Member


Joined: 08 December 2003
Location: United States
Status: Offline
Points: 285
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boyd Quote  Post ReplyReply Direct Link To This Post Posted: 22 February 2005 at 12:18pm

I finally got back in front of a PC with Codejock installed, so here's an update about detecting a value change in C#.

Indeed, the 'item' that was changed is exposed in the event args.  An event handler might look like the following:

private void axPropertyGrid_ValueChanged(object sender, AxXtremePropertyGrid._DPropertyGridEvents_ValueChangedEvent e)
{
    Console.WriteLine("Value Changed for " + e.item.Caption);
}



Edited by Boyd
Back to Top
bluelizard View Drop Down
Newbie
Newbie
Avatar

Joined: 24 March 2005
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote bluelizard Quote  Post ReplyReply Direct Link To This Post Posted: 24 March 2005 at 4:14pm
I'm using PropertyGrid in C# too.  The main problem with the ValueChanged event, as currently implemented, is that it's not that easy to find out what the value was before it was edited, so that if the data entered is invalid, you can set it back.  My hack around it is to store the current data value in the Tag property, and upon validation, change the value of the Tag property, otherwise reset the value back to what's in the Tag property.  Kinda hackish, but whatever works.

BlueLizard
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.172 seconds.