" Digit Catching From TextBox With C# "

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pedo
    New Member
    • Feb 2008
    • 4

    " Digit Catching From TextBox With C# "

    Hi. I have a little problem with "catching" a digit from a series of numbers. For example: I have a textfrom where you can enter six numbers (331256), then klick on the submit button and "take" digits 12 for comparison with some other digits. How do I do this with C# ?? The whole six numbers are already converted in personNr

    protected void buttonVisa_Clic k(object sender, EventArgs e){

    int personNr = Convert.ToInt32 (txtPersNr.Text );
    .....
    .....
    }

    Please Help :)
  • pedo
    New Member
    • Feb 2008
    • 4

    #2
    " Digit Catching From TextBox With C# "

    Hi. I have a little problem with "catching" a digit from a series of numbers. For example: I have a textfrom where you can enter six numbers (331256), then klick on the submit button and "take" digits 12 for comparison with some other digits. How do I do this with C# ?? The whole six numbers are already converted in personNr

    protected void buttonVisa_Clic k(object sender, EventArgs e){

    int personNr = Convert.ToInt32 (txtPersNr.Text );
    .....
    .....
    }

    Please Help :)

    Comment

    • todashah
      New Member
      • Feb 2008
      • 26

      #3
      Replace your code int personNr = Convert.ToInt32 (txtPersNr.Text );
      with
      int personNr = Convert.ToInt32 (txtPersNr.Text .Substring(2, 2));
      so u r able to store 12 in personNr from given no 331256

      Originally posted by pedo
      Hi. I have a little problem with "catching" a digit from a series of numbers. For example: I have a textfrom where you can enter six numbers (331256), then klick on the submit button and "take" digits 12 for comparison with some other digits. How do I do this with C# ?? The whole six numbers are already converted in personNr

      protected void buttonVisa_Clic k(object sender, EventArgs e){

      int personNr = Convert.ToInt32 (txtPersNr.Text );
      .....
      .....
      }

      Please Help :)

      Comment

      • idsanjeev
        New Member
        • Oct 2007
        • 241

        #4
        Hi pedo
        sorry you have to posted your question in .net forum

        Comment

        • pedo
          New Member
          • Feb 2008
          • 4

          #5
          Ok thanks :)

          But I would first like to store the six digits 331256 in personNr and then take digits 12 from personNr. Not take 12 directly from the textbox. How do I achieve that??

          Comment

          • markrawlingson
            Recognized Expert Contributor
            • Aug 2007
            • 346

            #6
            Moving thread to .net forum where you'll get more help.


            Sincerely,
            Mark

            Comment

            • Plater
              Recognized Expert Expert
              • Apr 2007
              • 7872

              #7
              I have merged the two threads.
              -MODERATOR-

              Originally posted by pedo
              Ok thanks :)

              But I would first like to store the six digits 331256 in personNr and then take digits 12 from personNr. Not take 12 directly from the textbox. How do I achieve that??
              What? You want to store the value as a single number, AND take out the 3rd and 4th digits?
              Just follow what was given above, but have 2 seperate variables, one to hold the 12 and one to hold the 331256

              Comment

              • pedo
                New Member
                • Feb 2008
                • 4

                #8
                Originally posted by todashah
                Replace your code int personNr = Convert.ToInt32 (txtPersNr.Text );
                with
                int personNr = Convert.ToInt32 (txtPersNr.Text .Substring(2, 2));
                so u r able to store 12 in personNr from given no 331256

                Ok thanks!!

                But what if I enter 920326-3456 in the textbox??

                How can I catch the numbers "03" or the nine numbers "920326345" ??

                Comment

                Working...