Source: http://amronbadriza.blogspot.com/2012/06/cara-memberi-burung-twitter-terbang-di.html#ixzz2Cjh0y8gV

Minggu, 06 Januari 2013

Re: only numbers in textbox

Posted 15 October 2008 - 06:03 PM
View Postjacobjordan, on 15 Oct, 2008 - 05:10 PM, said:
You were supposed to put that code in a KeyDown event, not a TextChanged Event. Create a KeyDown event for your text box, and put that same code in it. Like this:
1Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
2    If Asc(e.KeyChar) <> 13 AndAlso Asc(e.KeyChar) <> 8 _
3       AndAlso Not IsNumeric(e.KeyChar) Then
4            MessageBox.Show("Only Numbers")
5            e.Handled = True
6    End If
7End Sub


Same problem.

Attached image(s)

  • Attached Image

Tidak ada komentar:

Posting Komentar