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

怎么确定是哪个TextBox发生了TextChanged事件

2012-03-17 
如何确定是哪个TextBox发生了TextChanged事件?我有几个TextBox都统一绑定了同一个TextChanged事件,我现在

如何确定是哪个TextBox发生了TextChanged事件?
我有几个TextBox都统一绑定了同一个TextChanged事件,我现在想知道在发生TextChanged事件时是哪个TextBox发生的..该怎么处理呢。。。。

最好不要再用其它按键事件去确定......我蛋疼啊~~~嘿嘿....

[解决办法]
获取触发事件Textbox的名称不就得了。。
Change方法不是有个object参数么,那个就是触发事件的按钮,给它强转成TextBox就行了
[解决办法]

C# code
        private void textBox_TextChanged(object sender, TextChangedEventArgs e) {            TextBox testObj = sender as TextBox;        } 

热点排行