msgbartop
Arama Motoru Optimizasyonu , Scriptler ,Genel Bilgiler ve SEO Makaleleri
msgbarbottom

20 Ara 09 textBox’a sadece sayı girişi yaptırmak

textBox’ın keypress olayına aşağıdaki kodu yazıyoruz.

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
string str = “0123456789″;
if (str.IndexOf(e.KeyChar) == -1)
e.KeyChar = ‘\0′;
}

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)

{

string str = “0123456789″;

if (str.IndexOf(e.KeyChar) == -1)

e.KeyChar = ‘\0′;

}

Tags: , , ,

Leave a Comment