473,414 Members | 1,988 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,414 software developers and data experts.

Control format of input

4
hey I am using the VB6.0 and I creating an order entry form interface. So in my order form it has an Quantity, Rate and Description Column so in quantity and rate column I dont want to enter any letters on it only a number so I want to know what code do I have to make so when someone want to enter a letters a messagebox will appear and say "Invalid Number"....please can you help me out....
Jul 30 '07 #1
4 1193
pureenhanoi
175 100+
hey I am using the VB6.0 and I creating an order entry form interface. So in my order form it has an Quantity, Rate and Description Column so in quantity and rate column I dont want to enter any letters on it only a number so I want to know what code do I have to make so when someone want to enter a letters a messagebox will appear and say "Invalid Number"....pliz can you help me out....
Enter code into KeyPress Event
Expand|Select|Wrap|Line Numbers
  1. Private Sub TextBox1_KeyPress(KeyAscii As Integer)
  2. If (KeyAscii < Asc("0") Or KeyAscii>Asc("9")) And Not KeyAscii=8 Then
  3.   KeyAscii = 0
  4.   Msgbox "Invalid Number"
  5. End If
  6. End Sub
  7.  
You need KeyAscii = 8 to enable BackSpace key
Jul 31 '07 #2
Killer42
8,435 Expert 8TB
What type of control are you using to enter the information? If it's a text box, you might instead try looking into the Masked Edit Control - it allows you to control the format of the input.

Oh, and by the way. Please try to use a title which reflects what is in your message, not just "help".
Jul 31 '07 #3
lita
4
hey thnx 4 help 'n' sori abt that m jst little confuse.....okkkk...


What type of control are you using to enter the information? If it's a text box, you might instead try looking into the Masked Edit Control - it allows you to control the format of the input.

Oh, and by the way. Please try to use a title which reflects what is in your message, not just "help".
Aug 7 '07 #4
lita
4
hey thnx.....and m trying that coding it's work...see ya...


Enter code into KeyPress Event
Expand|Select|Wrap|Line Numbers
  1. Private Sub TextBox1_KeyPress(KeyAscii As Integer)
  2. If (KeyAscii < Asc("0") Or KeyAscii>Asc("9")) And Not KeyAscii=8 Then
  3.   KeyAscii = 0
  4.   Msgbox "Invalid Number"
  5. End If
  6. End Sub
  7.  
You need KeyAscii = 8 to enable BackSpace key
Aug 7 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: MLH | last post by:
From FormA or from the immediate window, what can I run to determine if a specified control (say, "MyComboBox") exists on FormB (or ReportB)? We could narrow it down, specifying that FormB (or...
0
by: Donal McWeeney | last post by:
Hi, I'm currently playing with a custom composite control at the moment and I can get it to get the posted data back in the control - however not the way I want it to. If I specify the...
1
by: panche | last post by:
I'm developing a fairly simple user control that has two textboxes for date/time entry (a from date/time and a to date/time). One of my requirements is that there should be no button that sets...
10
by: Dennis D. | last post by:
Hello: There are a series of textboxes (x.text, y.text, z.text etc.) in which user input is expected. As: dtmX=CDate(x.text) dtmY=CDate(y.text) dtmZ=CDate(z.text) where x, y, and z.text...
3
by: funkyMonkey | last post by:
I'm binding date fields from entity objects and formatting the output in the text box in short date format. Code: BindDateField(Me.txtCheckIn, "Text", reservation.BookingDetail, "CheckIn")...
0
by: Raven Jones | last post by:
Heya all, I'm working on a web-based application (using ASP.NET and C# on .NET 1.1.4322, supporting only IE6 for Windows) that allows for file uploads. Screen real estate is at a premium, so I...
1
by: Aur_Ros | last post by:
I am trying to get a string that contains the HTML code generated for a table control, Need help, examples about how to use render method and string builder, Thanks !!!
0
by: Anonieko | last post by:
Are there any javascript codes there? Answer: Yes On the PageLoad event call InitialClientControsl as follows /// <summary> /// This will add client-side event handlers for most of the...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
3
by: Allen Chen [MSFT] | last post by:
Hi Richard, Quote from Richard================================================== However I also want to be able to remove the panes. I have tried to include this, but find that when I first...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.