I’m trying to trap non-numeric entry in a regular text box including decimal point trapping

I put this code on the Keypress Event of the TextBox1 but it doesn’t work!

e.KeyChar = IIf((e.KeyChar >= Chr(48) And e.KeyChar <= Chr(57)) Or e.KeyChar = Chr(8) Or e.KeyChar = Chr(13) Or (e.KeyChar = Chr(46) And InStr(TextBox1.Text, ".") = Chr(0)), e.KeyChar, Chr(0))