在winform中,如何在textbox检查有多少个大写字母
在winform中,如何在textbox检查有多少个大写字母,恕我新手!!!求解!!!???? winform textbox
[解决办法]
int count = Regex.Matches(textBox1.Text, "[A-Z]").Count;
MessageBox.Show("有" + count + "个大写字母");
private int i = 0;
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
//大写字母A-Z的ASC码范围是65-90;
if ((int)e.KeyChar > 65 & (int)e.KeyChar < 90
[解决办法]
(int)e.KeyChar == 8)
{
i++;
}
MessageBox.Show(i.ToString());
}