private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
// if ( char.IsNumber(e.KeyChar) )
// {
// e.Handled = false;
// }
// else
// {
// e.Handled = true;
// }
if(e.KeyChar>='a' && e.KeyChar<='z' || e.KeyChar>='A' && e.KeyChar<='Z' )
{
//字母
e.Handled = true;
}
else if(e.KeyChar>='0' && e.KeyChar<='9')
{
//数字
e.Handled = false;
}
else if(e.KeyChar=='_')
{
//下划线
e.Handled = true;
}
else
{
//其他
e.Handled = true;
}
}