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

Visual Basic Electric Billing program

Hello friends. I am Jessie from the Philippines. Friends my problem is how to restrict my textbox so that the users cannot encode a letter.
Sep 28 '07 #1
5 4581
Killer42
8,435 Expert 8TB
Hello friends. I am Jessie from the Philippines. Friends my problem is how to restrict my textbox so that the users cannot encode a letter.
This has been covered in a couple of recent posts here. But probably your simplest solution is to use a Masked Edit control, which allows you to control the format of the input.

Otherwise, you can filter out the keys you don't want by intercepting them in the KeyDown event procedure.
Sep 28 '07 #2
jamesd0142
469 256MB
Code may be slightly incorrect but the idea is here...

on form keypress function,

if e.keychar() <> "0" | "1" | "2".......| "9" then
msgbox("please only use digits")
end if
Sep 28 '07 #3
QVeen72
1,445 Expert 1GB
Hi,

Write this code in KeyPress Event of textbox :

Expand|Select|Wrap|Line Numbers
  1. Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
  2.     If IsNumeric(e.KeyChar) Then
  3.         e.Handled = False
  4.     Else
  5.         e.Handled = True
  6.     End If
  7. End Sub
  8.  

REgards
Veena
Sep 28 '07 #4
Luzuko
8
Hi ,

i just want to thank you for the piece of code i got from you.
it's working perfectly on VB 2005 controls, however we're building our controls using Microsoft expression-Blend(user interface) and then program the user interface via Vb 2005. Now the problem is that the keypressed event doesn't show when we use the code on our User interface. Do you know any other event we can use for that code.
Oct 6 '07 #5
QVeen72
1,445 Expert 1GB
Hi,

You can check in Changed Event of the textbox, it fires whenever you add/edit/delete anything in a textbox, maybe you may have to modify a bit.

Regards
Veena
Oct 6 '07 #6

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

Similar topics

2
by: AK | last post by:
I don't want any part of the previous discussion on Visual Basic versus Visual Basic.Net. My query is about using Visual Basic for Applications; and whether it is better to use Visual Basic 6 or...
2
by: Scott | last post by:
Not sure if this is the right place to post this or not, but I am in the process of trying to find a Web Hosting/Isp Billing system that is reasonable in price and uses Access or SQL Server for a...
2
by: janice_2k | last post by:
Dear Sir/Mdm, I am writing this on behalf of my company. We bought the Visual Studio .NET Enterprise version but currently we need to use Visual Basic 6 for a small development. We are not able to...
2
by: Ralph | last post by:
I used to have Visual Basic .net std. 2003 installed on WinXP SP1A. But I found it too hard to upgrade WinXP to SP2. Now, I do have WinXP SP2 installed, but I am having problems installing...
18
by: Jeremy Weiss | last post by:
I'm trying to build a database that will handle the monthly billing needs of a small company. I'm charting everything out and here's what I see: table for customers sub table to track payments...
2
by: frossberg | last post by:
Hello! I tried to install the Visual Basic.NET Resource Kit (http://msdn.microsoft.com/vbasic/vbrkit/) but obviously something went very wrong and now it sems impossible both to repair and to...
4
by: sqlguy | last post by:
Why do we have to contact MS for a problem that has been with this compiler from at least the beta of VS 20005. I am so sick and tired of the 30 - 40 clicks it takes to dismiss VS when there is a...
6
by: DanielJohnson | last post by:
int main() { printf("\n Hello World"); main; return 0; } This program terminate just after one loop while the second program goes on infinitely untill segmentation fault (core dumped) on...
1
by: vai | last post by:
hi all, i'm developing a stock management system. in this system i'm developing a billing system which on daily & monthly basis. i'm using ms-acess database as backend & visual baic as front end....
1
by: kuleamo | last post by:
I designing a client / server system for internet billing using visual basic 2005. I had a problem with locking the client screen when not in use, how can i do this ?
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.