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

TextBox numerical values

Hi all,

how do I set a Textbox to only accept numerical values in vb .net

many thanks

rodger

Jul 21 '05 #1
4 2652
On Text Box Key Press event procedure write

if Not Instr(1,"1234567890",chr$(KeyAscii,0) > 0 or KeyAscii = 8) then
KeyAscii=0

Mr Utkal Ranjan, New Delhi.
Jul 21 '05 #2
I am not sure the NumericUpDown list is what I am looking for,

as what I have is a simple Textbox, and I just want to ensure that only
numbers are entered, (later they are picked up by a formula)

on further research i have found
TextBox1.Numeric = true

for VB

so maybe there is an equivalent for VB .net?
Herfried K. Wagner [MVP] wrote:
* rodger <pa*@myisland.spam> scripsit:
how do I set a Textbox to only accept numerical values in vb .net

Use a NumericUpDown control instead.


Jul 21 '05 #3
I am not sure the NumericUpDown list is what I am looking for,

as what I have is a simple Textbox, and I just want to ensure that only
numbers are entered, (later they are picked up by a formula)

on further research i have found
TextBox1.Numeric = true

for VB

so maybe there is an equivalent for VB .net?
Herfried K. Wagner [MVP] wrote:
* rodger <pa*@myisland.spam> scripsit:
how do I set a Textbox to only accept numerical values in vb .net

Use a NumericUpDown control instead.

Jul 21 '05 #4
Hello, rodger:

You may find useful the sample for the TextChanged event for the textbox:
http://msdn.microsoft.com/library/de...angedtopic.asp

Regards.
"rodger" <pa*@myisland.spam> escribió en el mensaje news:Oz*************@tk2msftngp13.phx.gbl...
| Hi all,
|
| how do I set a Textbox to only accept numerical values in vb .net
|
| many thanks
|
| rodger
|
Jul 21 '05 #5

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

Similar topics

2
by: Martin McCormick | last post by:
Most of the C programming I write manipulates strings so I haven't had much experience with numerical functions and passing variables in and out which brings me to a laughably simple problem that I...
2
by: RobRich | last post by:
I'm trying to figure out the best way to accomplish a task. I need to calculate the numerical values from about 300+ textboxes. Basiclly I have an application that users input checks and credit...
9
by: rodger | last post by:
Hi all, how do I set a Textbox to only accept numerical values in vb .net many thanks rodger
2
by: Abra | last post by:
Hi, I would like to allow only some pre-defined characters to be typed in a TextBox (for example only integer numerical, or float numerical, or only a set of letters and so on). How can this be...
16
by: Martin Jørgensen | last post by:
Hi, I've made a program from numerical recipes. Looks like I'm not allowed to distribute the source code from numerical recipes but it shouldn't even be necessary to do that. My problem is...
6
by: Avi G | last post by:
Hi, what is the code to limit a textbox that will accept only text and not number private void button1_Click(object sender, EventArgs e) { if (textBox1.Text = "numbers") { // do something }
10
by: Parachute | last post by:
Using Borland Builder 6, I get numerical overflow when running a small programme without CodeGuard ("exp: OVERFLOW error"). The programme does not give any error messages when CodeGuard is...
7
by: weg22 | last post by:
Hi all, I need to impose maximum and minimum numerical limits on a textbox. I'd prefer not to code these in (since I have many textboxes and the limits on each are different) and was wondering...
3
by: sannihith | last post by:
how do I set a Textbox to only accept numerical values in vb .net
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
0
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
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.