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

How to identify more than 1 decimal ?

Rob
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 button, then the 2 button, then the 3
button, the resulting number will be 123.

There is really no validation required unless a decimal point is involved.

How can I trap (I assume on KeyPress ?) for the user putting in more than 1
decimal point ?

Jun 16 '07 #1
4 1391
Tom
I would do it in the KeyPress event.

Use this:

If InStr(textboxnamehere.text,".") then
If e.KeyCode = Keys.Period then
e.Cancel = true
End If
End If

Rob wrote:
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 button, then the 2 button, then the 3
button, the resulting number will be 123.

There is really no validation required unless a decimal point is involved.

How can I trap (I assume on KeyPress ?) for the user putting in more than 1
decimal point ?
Jun 16 '07 #2
On Sat, 16 Jun 2007 10:30:06 -0400, "Rob" <ro***@yahoo.comwrote:
>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 button, then the 2 button, then the 3
button, the resulting number will be 123.

There is really no validation required unless a decimal point is involved.

How can I trap (I assume on KeyPress ?) for the user putting in more than 1
decimal point ?
You say the user is pressing buttons to enter numbers. If the decimal
point is also entered by pressing a button disable that button after
it is pressed once.
Jun 16 '07 #3

"Rob" <ro***@yahoo.comwrote in message
news:9L******************************@comcast.com. ..
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 button, then the 2 button, then the 3
button, the resulting number will be 123.

There is really no validation required unless a decimal point is involved.

How can I trap (I assume on KeyPress ?) for the user putting in more than
1 decimal point ?
use the textChanged event of the textbox you're building

If textBox1.Text.Contains(".") then
'** do not put another one in there
Else
textBox1.Text &= "."
End If

Jun 17 '07 #4
Rob,

If he clicks in more than 1 decimal point, (In English language cultures a
dot, in most others a comma) your Isnumeric gives an error. The most simple
way in my idea.

By the way, try to avoid the KeyPress, the KeyUp gives much more
information.

Cor

"Rob" <ro***@yahoo.comschreef in bericht
news:9L******************************@comcast.com. ..
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 button, then the 2 button, then the 3
button, the resulting number will be 123.

There is really no validation required unless a decimal point is involved.

How can I trap (I assume on KeyPress ?) for the user putting in more than
1 decimal point ?

Jun 17 '07 #5

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

Similar topics

2
by: Metropolis | last post by:
Hello All, I am currently trying to teach a web crawler how to identify blogs, that is I am trying to determine a fairly inclusive set of criteria that will help my crawler to identify them. ...
8
by: DraguVaso | last post by:
Hi, I want my application do different actions depending on the exception it gets. For exemple: I have an SQL-table with a unique index. In case I try to Insert a record that's alreaddy in it I...
29
by: Gaijinco | last post by:
Sooner or later everytime I found recreational programming challenges I stumble with how I test if a number is has decimal places differnt than 0? For example if I want to know if a number is a...
1
by: Dennis | last post by:
If a Window's form contains two textboxes, txtUserName for names and the other txtDimension for mathematical values, how could the program code be set up to identify that only letter character(s)...
3
by: Sri | last post by:
In VB, to know the field type of a column stored in a recordset the command I use is If rsQuery.Fields(k).Type = adCurrency Then How will I achieve the same in ASP.net. I could not find a...
161
by: KraftDiner | last post by:
I was under the assumption that everything in python was a refrence... so if I code this: lst = for i in lst: if i==2: i = 4 print lst I though the contents of lst would be modified.....
26
by: Christoph Zwerschke | last post by:
You will often hear that for reasons of fault minimization, you should use a programming language with strict typing: http://turing.une.edu.au/~comp284/Lectures/Lecture_18/lecture/node1.html I...
2
by: ArunDhaJ | last post by:
Hi Friends, I am using a Number field which stored Floating point values... For example: Field Name: Salary Field Data Type: Number Field Size: Decimal Decimal place: 2 I need to get the...
5
Claus Mygind
by: Claus Mygind | last post by:
I have a list box and want to limit the user to selecting a max of 5 items from the list. I've put in a counter which warns the user that more than 5 items have been selected, however I cannot...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.