You have two things wrong in your sub declaration, first of all you should use the KeyPress event, and it should be 'ByVal' instead of 'By Val'
(Might have been a typo, don't know)
Your KeyAscii should be working now, and you can check if the KeyAscii is numerical, or the delete, backspace keys or whatever keys you need.
That's a very strange sub. It looks like an event handler, but it isn't a typical one by any stretch, at least not in .NET. Since I'm unclear on the language, I'm not going to suggest a solution, as I don't even remember what a VB6 event handler looks like, so it could be one of those. However, you should really ask a moderator to move this thread to the proper forum, as you will get better responses than this one.
That code should allow the user to enter multiple decimal points as well, which won't give correctly-formed results. That case is easy to deal with, though, given the example.
The time you enjoy wasting is not wasted time. Bertrand Russell
Since this is .NET 2008, search for that topic in the .NET forum. The question gets answered about once a week or so, and there are a variety of solutions. Pick the one you prefer.
One option that isn't very good, but is similar to an earlier suggestion here would be to use Double.TryParse (or Integer.TryParse if decimals are not allowed). That would return True if the string was a double, and False if it was not. However, it wouldn't restrict the textbox entries to just numeric characters. It seems that there were a series of answers based on regular expressions, but I haven't dealt with this problem, so I haven't been looking for a solution.
It won't be better in VB6, because you'll be trapped into a language that is four versions out of date. You should be asking this in the .NET forum, not here, but here's a link to a thread that may help. The last snippet in the first post should cover most situations for you: