473,320 Members | 1,884 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.

Do any body know how to validate text box for alphanumeric charactes only in c#.net??

M doing an application where i need to validate a text box contaning name for only alphanumric characters.

M using windows forms in c#..can anybody tell me the methos to do this???
Oct 22 '07 #1
6 3520
Plater
7,872 Expert 4TB
Use a MaskedTextBox?
Oct 22 '07 #2
I m using visual studio .net 2003....can u pls tel me how to do that???
Oct 22 '07 #3
Plater
7,872 Expert 4TB
Hmm it is not available until .net2.0...

You could consider something like this:
Expand|Select|Wrap|Line Numbers
  1. string mycheckstr=mytextbox.Text;
  2. for(int i=0; i<mycheckstr.Length;i++)
  3. {
  4.    if (Char.IsLetter(mycheckstr,i)==false)
  5.    {//string contains something other then a digit
  6.    }
  7. }
  8.  
Oct 22 '07 #4
It works

Thanku very much


You are g888
Oct 22 '07 #5
rg701
2
how did u solve it? I got to do the same and have never worked on .net 2003


I m using visual studio .net 2003....can u pls tel me how to do that???
Mar 22 '08 #6
Frinavale
9,735 Expert Mod 8TB
how did u solve it? I got to do the same and have never worked on .net 2003
Have you tried using the code Plater posted in post #4?


-Frinny
Mar 22 '08 #7

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

Similar topics

1
by: Drifter | last post by:
I am working with a form that has to do 2 things: 1) Validate that 9 checkboxes are checked (from a dynamically generated list of topics). 2) Take the 9 Topics, and put them into an e-mail...
1
by: Gordon - Adelphia | last post by:
I have a question regarding xhtml. Why, why, why does the ELEMENT <body> allow “unblocked” text. HTML does not (though, most browsers will render). Xhtml (transitional) however allows text nodes...
22
by: Jason Heyes | last post by:
Does this function need to call eof after the while-loop to be correct? bool read_file(std::string name, std::string &s) { std::ifstream in(name.c_str()); if (!in.is_open()) return false; ...
15
by: Matthias Hullin | last post by:
Hi, I'm programming some PHP discussion board that is supposed to appear inside the content area of a proprietary CMS. As I need some more styles than the standard stylesheet provides, I just...
5
by: Patient Guy | last post by:
I have this in a document: <body onload="a_function(this);"> In an (external) script file, I define a_function() as follows: function a_function(obj) { // surprise errant coding here
0
by: ntuser_man | last post by:
Howdy I'm trying to validate the content of a csv uploaded to a web page. I imported the csv into a DataSet and now I want to loop through all the elements in the DataSet to validate that each is...
2
by: John Buell | last post by:
When I generate an html email to send via SmtpMail, it will (apparently) randomly remove a period in the filename for some image and anchor tags, but not all For example, in the email body, i may...
7
by: Fernando Rodríguez | last post by:
Hi, How can I know if a string only has alfanumeric chars? Thanks
2
by: Mike | last post by:
Hi, I have this app that downloads a webpage via a WebClint object. It then strips out all the unnecessary tags so that I have data that looks similiar to ...
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...
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: 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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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: 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...

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.