Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Property Grid
  New Posts New Posts RSS Feed - Checking for allowed values in propertygrid
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Checking for allowed values in propertygrid

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


Joined: 29 September 2007
Status: Offline
Points: 85
Post Options Post Options   Thanks (0) Thanks(0)   Quote wakerunner Quote  Post ReplyReply Direct Link To This Post Topic: Checking for allowed values in propertygrid
    Posted: 14 March 2008 at 1:23am
The code below works when you step through it 1 line at a time, however when you run the program it does not work. I am doing something wrong? Is there another/better way to chack values and correct if they are not an acceptable range? I am trying to make sure the entry is a number between 0 and 5.
 
Private Sub PG1_AfterEdit(ByVal Item As XtremePropertyGrid.IPropertyGridItem, NewValue As String, Cancel As Boolean)

NewValue = Left$(Trim$(NewValue), 1)
If Val(NewValue) = 0 Then NewValue = "0"

If Val(NewValue) > 5 Then NewValue = "5"
Item.Value = NewValue


End Sub

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: 14 March 2008 at 4:20am
Hi,
 
Thanks, looks like its our bug. :(
 
Please use ValueChanged instead:

Private Sub PropertyGrid1_ValueChanged(ByVal Item As XtremePropertyGrid.IPropertyGridItem)
   
    If Item.Value > 5 Then Item.Value = 5
End Sub
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.