为什么都不执行?

tiantianxiaoqiang 2010-01-29 10:38:10
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MenuSample
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void textBox1_TextChanged(object sender, EventArgs e)
{
MessageBox.Show("有改变哦!");
}

private void button1_Click(object sender, EventArgs e)
{

}

private void textBox1_TextChanged_1(object sender, EventArgs e)
{

}
private void texyBox1_KeyPress(object senter, KeyPressEventArgs e)
{
MessageBox.Show("您操作的键盘");
}
}
}

TextChange和KeyPress 都没有执行,是哪里错了?谢谢
...全文
93 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
YES20100129 2010-01-29
  • 打赏
  • 举报
回复
看不明白啊~~~~~~
flyfly2008 2010-01-29
  • 打赏
  • 举报
回复
教你一招,把它删除了,添加事件一次,我以前也遇到过这种情况。
swan01 2010-01-29
  • 打赏
  • 举报
回复
没注册事件
aptom 2010-01-29
  • 打赏
  • 举报
回复
我是进来学习的。
qlzf11140820 2010-01-29
  • 打赏
  • 举报
回复
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
textBox1.KeyPress += new KeyPressEventHandler(textBox1_KeyPress);
textBox1.TextChanged += new EventHandler(textBox1_TextChanged);
}

private void textBox1_TextChanged(object sender, EventArgs e)
{
MessageBox.Show("有改变哦!");
}

private void button1_Click(object sender, EventArgs e)
{

}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}
private void texyBox1_KeyPress(object senter, KeyPressEventArgs e)
{
MessageBox.Show("您操作的键盘");
}
}
qlzf11140820 2010-01-29
  • 打赏
  • 举报
回复

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
textBox1.KeyPress += new KeyPressEventHandler(textBox1_KeyPress);
textBox1.TextChanged += new EventHandler(textBox1_TextChanged);

}

private void textBox1_TextChanged(object sender, EventArgs e)
{
MessageBox.Show("有改变哦!");
}

private void button1_Click(object sender, EventArgs e)
{

}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}
private void texyBox1_KeyPress(object senter, KeyPressEventArgs e)
{
MessageBox.Show("您操作的键盘");
}
}
可能没注册事件
江南小鱼 2010-01-29
  • 打赏
  • 举报
回复
textBox1 AutoPostBack属性设置为true
huwei12345 2010-01-29
  • 打赏
  • 举报
回复
有没有绑定到 textBox1 上哟?
textBox1_TextChanged :需要失去焦点
whslovexyp 2010-01-29
  • 打赏
  • 举报
回复
看下你的textBox加的事件是否是这几个

110,535

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧