Exception

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mathewgk80
    New Member
    • Sep 2007
    • 103

    #1

    Exception

    Hi all,

    I have to enter a date in a textbox manually. I want to raise an exception if some other values are entered in the textbox instead of numbers.

    What is the exeption to be raised if i do not enter numbers in the textbox?
    I am using ASP.NET and C#.NET

    Please help me..

    Regards,
    Mathew
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    DateTime.Parse( ) can be used to determine if a string can be made into a DateTime. If it can't, it will throw an exception.

    Comment

    • mathewgk80
      New Member
      • Sep 2007
      • 103

      #3
      Originally posted by Plater
      DateTime.Parse( ) can be used to determine if a string can be made into a DateTime. If it can't, it will throw an exception.
      Hi Plator,
      I declared the date variable as string. Not in DateTime format.



      Regards

      Mathew

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Originally posted by mathewgk80
        I declared the date variable as string. Not in DateTime format.
        Ok, how does that effect anything?

        DateTime.Parse( string)

        Comment

        • mathewgk80
          New Member
          • Sep 2007
          • 103

          #5
          Originally posted by Plater
          Ok, how does that effect anything?

          DateTime.Parse( string)
          Hi Plator,
          The problem is solved..

          Thanks a lot for your suggestion....

          Thanks and regards,
          Mathew

          Comment

          Working...