Private Sub txt1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt1.KeyPress<br /> Try<br /> If Not (Char.IsNumber(e.KeyChar) Or Char.IsControl(e.KeyChar)) Then e.Handled = True<br /> Catch ex As Exception<br /> MsgBox(ex.ToString)<br /> End Try<br /> End Sub