Erikvandervelde Posted June 12, 2003 Posted June 12, 2003 Hi there! I'm using a propertyGrid on my form to change the properties of some objects. When I have an integer-property. I'm still able to type non-numeric characters as a value in the propertygrid. The result is that the class gives back an exception. How can I prevent numeric values typed in this textbox? Events such as 'keydown' and 'keyup' aren't fired. Does anybody has a solution for my problem? Regards, Erik van der Velden. Holland Quote
*Gurus* divil Posted June 12, 2003 *Gurus* Posted June 12, 2003 As far as I'm aware the propertygrid doesn't offer this level of interaction. You'll probably have to make do with the fact that they can type in letters, but it won't actually let them apply them to a numeric data type. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
*Experts* mutant Posted June 12, 2003 *Experts* Posted June 12, 2003 Put this in PropertyValueChanged event: If e.ChangedItem.Label = "nameofyourproperty" Then Try Integer.Parse(e.ChangedItem.Value) Catch ex As Exception MsgBox("No numbers!") End Try End If Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.