How To Validating Float,Date,Time in C#?
-
Hi gurus, I am facing a problem while validating float,date,time values in string variables in c#. Can Anybody tell me the way to validate the values. plz help. thanks in advance.:) Nitin...
Use
Double.TryParse
orDateTime.TryParse
.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
Use
Double.TryParse
orDateTime.TryParse
.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
Hi gurus, I am facing a problem while validating float,date,time values in string variables in c#. Can Anybody tell me the way to validate the values. plz help. thanks in advance.:) Nitin...
Hi, Use the try catch block ! try { DateTime.Parse(textBox1.Text) // code if it is date ! } catch(Exception ex) { //error code }
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
-
Hi, Use the try catch block ! try { DateTime.Parse(textBox1.Text) // code if it is date ! } catch(Exception ex) { //error code }
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
-
hi, i checked the way you suggested, it worked with double.tryparse but there is no such option like datetime.tryparse. please check this out. thanks. Nitin.
There is a
DateTime.TryParse
method! It's new with the Framework 2.0 but as you founddouble.TryParse
you're clearly using this version. Maybe you misspelled.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
There is a
DateTime.TryParse
method! It's new with the Framework 2.0 but as you founddouble.TryParse
you're clearly using this version. Maybe you misspelled.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
-
hi, thanks for the link. it suggest that DateTime.TryParse exits. but dont know which version of .net m using i cant find DateTime.TryParse. i ll hv to check the version. thanks:)