473,473 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

textbox control

Hello,

i have text box control in from(windows form). Now i want that this textbox
could accept only numeric values. In MFC editbox had special option (number)
and everything was well, but in C# i can't find anything like that.

Programming language C#

Thank you.
Nov 15 '05 #1
4 5881
Hi,

This issue has been discussed before in this NG, take a look at the history
in google:
http://groups.google.com/groups?hl=e...ric+validation

This is a method that I have used:
http://groups.google.com/groups?hl=e...2522%26meta%3D
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"kidzero" <ki*****@takas.lt> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...
Hello,

i have text box control in from(windows form). Now i want that this textbox could accept only numeric values. In MFC editbox had special option (number) and everything was well, but in C# i can't find anything like that.

Programming language C#

Thank you.

Nov 15 '05 #2
If you're interested, check out the article at:
http://www.codeproject.com/cs/miscct...oxControls.asp

This article includes the C# source code for 9 different text box controls
including: Alphanumeric TextBox, Currency TextBox, Date TextBox, DateTime
TextBox, Integer TextBox, Masked TextBox, Multi-Masked TextBox, Numeric
TestBox, and Time TextBox.

It's a well-written article and nice example of C# code.

- FWIW, Jeff
"kidzero" <ki*****@takas.lt> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...
Hello,

i have text box control in from(windows form). Now i want that this textbox could accept only numeric values. In MFC editbox had special option (number) and everything was well, but in C# i can't find anything like that.

Programming language C#

Thank you.

Nov 15 '05 #3
take a look at the following article. basically you have two choices:

1. let the user write whatever he/she wants, then show an error message and
focus the textbox using validating and validated events

2. you can detect the characters entered into the textbox using the keydown
or some other event and simply ignore that character (in your case which are
not numeric)

http://www.informit.com/isapi/produc...t/articlex.asp

"kidzero" <ki*****@takas.lt> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...
Hello,

i have text box control in from(windows form). Now i want that this textbox could accept only numeric values. In MFC editbox had special option (number) and everything was well, but in C# i can't find anything like that.

Programming language C#

Thank you.

Nov 15 '05 #4
Thank you for the answers ! :)
"kidzero" <ki*****@takas.lt> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...
Hello,

i have text box control in from(windows form). Now i want that this textbox could accept only numeric values. In MFC editbox had special option (number) and everything was well, but in C# i can't find anything like that.

Programming language C#

Thank you.

Nov 15 '05 #5

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

Similar topics

0
by: Mark Johnson | last post by:
The last reply got sort of cutoff. So here again: So for anyone interested, here's the simple regexp patterns for the substitutions required. The textbox control is being 'zoomed' in a popup...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
2
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow...
0
by: Dot net work | last post by:
Hi, Make up a very simple project as follows: 1 aspx form 3 web user controls (referred to as A, B, and C) "A" web user control: Put 1 textbox and 1 button on this web user control. (You...
7
by: I am Sam | last post by:
I have a DataGrid that is passing information to a stored procedure properly but the parameters aren't being casted properly. I was woundering if anyone can tell me how I should properly cast the...
4
by: Samy | last post by:
Hi There, I have a user control with a textbox and a button which when clicked opens a calendar control(calendar.aspx page). When I select a date from the calendar control, the date is supposed to...
11
by: Keith | last post by:
I apologize for those of you who think I'm posting on the same topic. It is not that I don't appreciate all of your comments - and I'm definitely reading them all - but I think I have a differing...
2
by: Mamatha | last post by:
Hi I want to add an icon to the textbox's text. I don't know how to display icon in textbox in VB.NET. If any one knows please let me know. Thanks in advance. Mamatha
6
by: RP | last post by:
I want to clear all the Text Boxes on the Form. Is there any short method to avoid clearing them one by one.
8
by: Marco Pais | last post by:
Hi there. How can I change the background color of a textbox when it gets the focus? I can handle the "Enter" event and do this private void txtDummie_Enter(object sender, EventArgs e) { ...
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
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...
1
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.