KeyAscii
|
KeyAscii KeyAscii is important to a project if you are making a calculator or
somthing that requires specific text. If you use a calculator, you should notice that you
cant type A through to Z, this is done by useing KeyAscii. Private Sub Text1_KeyPress(KeyAscii As Integer) In this example above when you type into Text1 you can only type numbers 0 to 9 and can only press the BackSpace key. If you was to use this as a calculator you would soon find a major problem, the Decimal point has been filterd with the KeyAscii. There is no Decimal Point in Visual Basics Variables, so we will have to make one. Place the below in your General Declarations area. Option Explicit This is simply declaring the Decimal Point, if you know change the Text1_KeyPress to .... Private Sub Text1_KeyPress(KeyAscii As Integer) This should allow only numbers the BackSpace and the Decimal Point to be pressed. If the user trys to enter any other letter, a Beep will be heard. |
If you have any problems, broken links or just infomation or a
query then please E-Mail me Here. |