如何将按键事件添加到Property Grid Veiw [英] How Can I Add Key Press Event To Property Grid Veiw

查看:54
本文介绍了如何将按键事件添加到Property Grid Veiw的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用visual studio 2008 .Net 3.5 WindowsApllication开发我的应用程序,我正在使用属性网格视图。

我想在用户在datafeild上写一些内容时限制字符串的长度,例如maxlength 100 user绝不允许写更多100

所以我想在属性网格中调用KeyPress事件我没有找到

如果用户在写东西时怎么办? Propertgrid datafeild,我使用了ProperyvalueChanged事件,但它没有用?

i am developing my application with visual studio 2008 .Net 3.5 WindowsApllication where i am using property grid veiw.
I want to limit length of string when user write something on datafeild for example maxlength 100 user must not allowed to write more that 100
So i want to call KeyPress event in property grid which i didn#t find
How can i do so when user write something in Propertgrid datafeild, I used ProperyvalueChanged Event but it didnt work ??????????

推荐答案

使用CellValidating检查长度是否超过100。 ..如果设置e.Cancel = false所以它不会传播。



如果一切正常,请使用CellValidated事件来保存值



如果这有帮助,请花些时间接受解决方案,以便其他人可以找到它。
Use CellValidating to check if the length is longer then 100...if it is set e.Cancel = false so it doesn't propagate.

If everything is OK, use CellValidated event to save the value

If this helps, please take time to accept the solution so others may find it.


使用
validation property

或者你可以使用

jquery validation

来验证te这类工作..

to validate this type of work..


Iam谈论Propertygrid而非Datagrid

如何用属性网格引发单元格验证事件
Iam talking about Propertygrid not Datagrid
how can i raise a cell validating event with property grid


这篇关于如何将按键事件添加到Property Grid Veiw的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆