473,324 Members | 2,456 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.

Capture and Identify User Input

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) are entered into
txtUserName .... and that only numbers and decimals are entered into
txtDimension ?

Secondly, how could the program code be set up to inform the user that the
wrong type of data was entered ?

All constructive suggestions are welcome.

Dennis
Nov 15 '05 #1
1 1761
Dennis wrote:
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) are entered into txtUserName .... and that only numbers and decimals are entered into
txtDimension ?
The System.Text.RegularExpressions.Regex class will handle this quite
nicely:

Regex.IsMatch(<someString>, "([a-zA-Z]+)") will return false if the
supplied string does not consist solely of alphabetic characters.

Regex.IsMatch(<string>, "([0-9]+).") will return false if the supplied
string does not consist solely of numeric characters with an optional
decimal.
Secondly, how could the program code be set up to inform the user
that the wrong type of data was entered ?


You can either perform the checking when they press an OK or Submit
button or you can handle the TextChanged event and perform the checking
as the user enters the values. In either case, just throw up a MessagBox
alerting then to the problem.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 15 '05 #2

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

Similar topics

8
by: George Hester | last post by:
When the address bar is highligted? That is nothing on the page is selected. The address bar is selected. Capture keydown or keypress? Any ideas using javascript? Thanks. -- George Hester...
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...
2
by: Paresh Shah | last post by:
Hi Friends... I have an query on how to capture onFocus event for all the input controls without writing onFocus event in the <input> tag. say my html form has 3 or 4 or 5 input text boxes,...
5
by: Chris | last post by:
I want to capture a users windows login Id and display it in asp.net web page (using VB.net). Any and all suggestions accepted.. A code snippet wud be really appreciated. Read an article in...
2
by: TC | last post by:
Hello, I need to build a very simple text editor. The requirement is that the input screen should be divided into 'm*n' cells ('m' rows, 'n' columns, with each cell of a fixed size). Whenever...
6
by: trbjr | last post by:
Hello experts, I want to describe a project design and then ask some questions at the end. There is no code in this discussion, just symbols to illustrate an idea. Let S stand for a screen...
11
by: Randy | last post by:
I have a MonthCalendar on one of my forms. I have disovered that the DateChanged event is triggered not only when the user clicks on a new date, but also if they click on the Previous or Next...
9
by: dudelideisann | last post by:
Hi! I have a form where the user enters some input. The input will eventionally become a database table. When he hit the 'submit' button the info is put into an array and then into a session...
2
by: ekasII | last post by:
I'm trying to capture text input by user to file, password = wx.TextCtrl(self.panel_1,wx.ID_ANY,pos=(230,150),size=(200,20),style= wx.TE_PASSWORD) l__password_file = <path\file.txt>...
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: 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...
1
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....
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.