首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

异常System.EventArgs并不包含“KeyChar”的定义

2012-04-15 
错误System.EventArgs并不包含“KeyChar”的定义C# codeprivate void txtArea_TextChanged_1(object sender,

错误System.EventArgs并不包含“KeyChar”的定义

C# code
private void txtArea_TextChanged_1(object sender, EventArgs e)        {            if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar))            {                MessageBox.Show("只能输入数字", "提示",//弹出消息对话框                    MessageBoxButtons.OK, MessageBoxIcon.Information);                e.Handled = true;//已经处理过此事件            }        }

运行后提示
错误4“System.EventArgs”并不包含“KeyChar”的定义
错误5“System.EventArgs”并不包含“Handled”的定义
我是小白,没找到是哪里的出的问题,求指点。。

[解决办法]
你事件搞错了,吧,应该是KeyPress或KeyDown吧,你那个是text内容变化事件,没有KeyChar
[解决办法]
txtArea_TextChanged事件中的e是没有KeyChar和handled的,所以报错了

热点排行