473,378 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

VB6 Keyacsii code statement into vb.net????

Hi all, does anyone know what the how to get this vb6 code to work under
vb.net?
I only want to allow digits, backspace and a period to be entered into a
text box.

Private Sub Text13_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57 ' Allow digits
Case 8 ' Allow backspace
Case 46 ' Allow period
Case Else
KeyAscii = 0
Beep
End Select
End Sub


Thanks,

Gary
Jul 21 '05 #1
2 3878
In the KeyPress event of the TextBox, have:

If Not (Char.IsNumber(e.KeyChar) OrElse AscW(e.KeyChar) = 8 OrElse
AscW(e.KeyChar) = 46) Then
e.Handled = True
Else
Beep()
End If

"Gary" <sp**@spam.net.at> wrote in message
news:Mj******************@news-server.bigpond.net.au...
Hi all, does anyone know what the how to get this vb6 code to work under
vb.net?
I only want to allow digits, backspace and a period to be entered into a
text box.

Private Sub Text13_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57 ' Allow digits
Case 8 ' Allow backspace
Case 46 ' Allow period
Case Else
KeyAscii = 0
Beep
End Select
End Sub


Thanks,

Gary

Jul 21 '05 #2
Thanks for that :-)

Gary
"Shiva" <sh******@online.excite.com> wrote in message
news:OJ**************@tk2msftngp13.phx.gbl...
In the KeyPress event of the TextBox, have:

If Not (Char.IsNumber(e.KeyChar) OrElse AscW(e.KeyChar) = 8 OrElse
AscW(e.KeyChar) = 46) Then
e.Handled = True
Else
Beep()
End If

"Gary" <sp**@spam.net.at> wrote in message
news:Mj******************@news-server.bigpond.net.au...
Hi all, does anyone know what the how to get this vb6 code to work under
vb.net?
I only want to allow digits, backspace and a period to be entered into a
text box.

Private Sub Text13_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57 ' Allow digits
Case 8 ' Allow backspace
Case 46 ' Allow period
Case Else
KeyAscii = 0
Beep
End Select
End Sub


Thanks,

Gary

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: George Sakkis | last post by:
Is there a general way of injecting code into a function, typically before and/or after the existing code ? I know that for most purposes, an OO solution, such as the template pattern, is a cleaner...
12
by: Steven T. Hatton | last post by:
This is something I've been looking at because it is central to a currently broken part of the KDevelop new application wizard. I'm not complaining about it being broken, It's a CVS images. ...
8
by: Paul Cochrane | last post by:
Hi all, I've got an application that I'm writing that autogenerates python code which I then execute with exec(). I know that this is not the best way to run things, and I'm not 100% sure as to...
2
by: Gary | last post by:
Hi all, does anyone know what the how to get this vb6 code to work under vb.net? I only want to allow digits, backspace and a period to be entered into a text box. Private Sub...
13
by: eman1000 | last post by:
I was recently looking at the prototype library (http://prototype.conio.net/) and I noticed the author used the following syntax: Object.extend(MyObj.prototype, { my_meth1: function(){},...
28
by: Steven Bethard | last post by:
Ok, I finally have a PEP number. Here's the most updated version of the "make" statement PEP. I'll be posting it shortly to python-dev. Thanks again for the previous discussion and suggestions!...
7
by: Steven Bethard | last post by:
I've updated PEP 359 with a bunch of the recent suggestions. The patch is available at: http://bugs.python.org/1472459 and I've pasted the full text below. I've tried to be more explicit about...
20
by: John Salerno | last post by:
I'm starting out with this: try: if int(text) 0: return True else: self.error_message() return False except ValueError: self.error_message()
23
by: florian.loitsch | last post by:
According to the spec Section 14 the production SourceElements:SourceElements SourceElement is evaluated as follows: 1. Evaluate SourceElements. 2. If Result(1) is an abrupt completion, return...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.