Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
if (textbox1.text Mod 1) <> 0 Then
MsgBox("ใส่ตัวเลขที่เป็นจำนวนเต็ม")
End Sub
Private Sub TextBox1_KeyPress_1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Select Case Asc(e.KeyChar)
Case 48 To 57, 8, 45 'รับค่า 0-9 และ backspace
Case Else
e.Handled = True
End Select
End Sub