5/14/2010

[ C# ] 如何做到"只能鍵入數字"

參考看看囉 :D


private void txt_KeyPress(object sender, KeyPressEventArgs e)

{

if (e.KeyChar.CompareTo('0') < 0

e.KeyChar.CompareTo('9') > 0)

e.Handled = true;

}