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

Intercepting the 0 key and decimal point validation in a calculator

1
I create a calculator in visual basic and I put button from 0 to 9 ... and event click
textbox1.text = textbox1 + "1" (to 9) ..it work good .. but if i press key 0 from keybord nothing is hapens ....who can help me to solve this problem

and the secoun problem .. if I put for example 3.25.89 not 3.2589 how can write in code a "if" for example if textbox1.text -alredy contain a point (.) 3.25 then I click again on button point .. it remain 3.25 but not 3.25.
Feb 27 '10 #1
3 2927
semomaniz
210 Expert 100+
Please post you code and show us what you have done
Mar 1 '10 #2
mshmyob
904 Expert 512MB
Check out my code here. It takes care of it.

cheers,
Mar 11 '10 #3
Frinavale
9,735 Expert Mod 8TB
If you press any key from the keyboard the user has to be in the TextBox that contains the number.

You should probably change the TextBox into a MaskedTextBox so that the user is forced to enter a number that is in the format that you are expecting (for example they can only enter one decimal point).

-Frinny
Mar 12 '10 #4

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

Similar topics

21
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing/modifying the code. Thank you. .. Facundo
17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
2
by: scott cooper | last post by:
I want to intercept the submit event for field validation to cancel this action if validation failes. I tried to script using the submit method and also use the FireEvent("OnSubmit") method but...
8
by: SAN CAZIANO | last post by:
i have to do in the onkeypress or in onchange the float (real) field validation I try something: function ValidaCampo(nomeCampo,TotInteri,TotDecimali) {...
687
by: cody | last post by:
no this is no trollposting and please don't get it wrong but iam very curious why people still use C instead of other languages especially C++. i heard people say C++ is slower than C but i can't...
5
by: RichW | last post by:
Hi, I'm writing a program that has got a bit of maths in it. I perform a division and then end up with something like 2.50, or 3.87, or 4.9975 (ie. y.12345). I need to get rid of anything in...
19
by: TexasNewbie | last post by:
This was originally just a calculator without a decimal point. After I added the decimal, it now tells me invalid second number. //GUI Calculator Program import javax.swing.*; import...
4
by: Rob | last post by:
Using VS 2005 I have an application whereby the user clicks on numbered buttons in order to "build" a number.... (kind of like the calulator application). Example... if they click on the 1...
3
by: Dave Griffiths | last post by:
Hi All Using VB 2005 I am writing a program that will be used on machines which have different locales (English, Norwegian and Swedish) I am restricting textbox input using keypress to just...
4
dlite922
by: dlite922 | last post by:
I have a query with number fields that contain floats with zero to three decimal places. When I SUM even just two of them together the sum() field fills up the precision up to the float max value. ...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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
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...

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.