Print Page | Close Window

Checking for allowed values in propertygrid

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=9889
Printed Date: 02 May 2024 at 8:15am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Checking for allowed values in propertygrid
Posted By: wakerunner
Subject: Checking for allowed values in propertygrid
Date 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




Replies:
Posted By: Oleg
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net