Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Visual Studio Tools for office 2005 KeyPress event

Posted on 2007-11-20
2
Medium Priority
?
423 Views
Last Modified: 2013-11-26
Hi

I am converting an Excel VBA project to Visual Studio Tools for Office 2005.
In the VBA project I use the following code in the KeyPress event of a text box
to prevent anything other than numbers being typed in
        'If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0
What is the equivalent code in Visual Studio 2005 VB?

Thanks
0
Comment
Question by:Murray Brown
2 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 2000 total points
ID: 20325715
do something like:

If e.KeyChar < Convert.ToChar(48) Or e.KeyChar > Convert.ToChar(57) Then e.KeyChar = Convert.ToChar(0)

where 'e' represent the KeyPressEventArgs argument
0
 

Author Closing Comment

by:Murray Brown
ID: 31410303
Thanks Jaime. Excellent answer!
0

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Screencast - Getting to Know the Pipeline

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question