Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How To Solve This ? start wtih numeric Value

How To Solve This ? start wtih numeric Value

Scheduled Pinned Locked Moved C#
helptutorialquestion
11 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P pakpatel

    In textbox.. when ever user write his address, He has to start with Numeric value then after all he can use what ever he want ? if he not use numreic value, then message come up. Can anyone help me with that? -Thanks

    Peter

    D Offline
    D Offline
    damianrda
    wrote on last edited by
    #2

    create an event listener for the textbox textchanged event, parse the string, if the first character (or two or three, etc..) are numeric, then proceed, else, if the first char is not numeric, display a messagebox and clear the textbox.

    P 1 Reply Last reply
    0
    • D damianrda

      create an event listener for the textbox textchanged event, parse the string, if the first character (or two or three, etc..) are numeric, then proceed, else, if the first char is not numeric, display a messagebox and clear the textbox.

      P Offline
      P Offline
      pakpatel
      wrote on last edited by
      #3

      but how do i chek that condition...i have to use substring or pls help me with that ?

      Peter

      M 1 Reply Last reply
      0
      • P pakpatel

        but how do i chek that condition...i have to use substring or pls help me with that ?

        Peter

        M Offline
        M Offline
        MoustafaS
        wrote on last edited by
        #4

        use if(IsNum(textBox1.Text[0])), As IsNum is a function you may create and takes a parameter of char to check if its a number.


        About : Islam
        About : Me

        1 Reply Last reply
        0
        • P pakpatel

          In textbox.. when ever user write his address, He has to start with Numeric value then after all he can use what ever he want ? if he not use numreic value, then message come up. Can anyone help me with that? -Thanks

          Peter

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #5

          pakpatel wrote:

          when ever user write his address, He has to start with Numeric value

          Are you really, really sure about that?? You're making a bad assumption here...

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          P 1 Reply Last reply
          0
          • D Dave Kreskowiak

            pakpatel wrote:

            when ever user write his address, He has to start with Numeric value

            Are you really, really sure about that?? You're making a bad assumption here...

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            P Offline
            P Offline
            pakpatel
            wrote on last edited by
            #6

            Ya i know but what i do man..that's how they want ?

            Peter

            D 1 Reply Last reply
            0
            • P pakpatel

              In textbox.. when ever user write his address, He has to start with Numeric value then after all he can use what ever he want ? if he not use numreic value, then message come up. Can anyone help me with that? -Thanks

              Peter

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #7

              Split the numeric part away from the non-numeric part.

              1 Reply Last reply
              0
              • P pakpatel

                In textbox.. when ever user write his address, He has to start with Numeric value then after all he can use what ever he want ? if he not use numreic value, then message come up. Can anyone help me with that? -Thanks

                Peter

                C Offline
                C Offline
                carbon_golem
                wrote on last edited by
                #8

                use Regex when the textbox fires it's Validating event. if the Regex fails, you can clear the box. http://www.dotnetcoders.com/web/Learning/Regex/syntax.aspx[^]

                "Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand

                1 Reply Last reply
                0
                • P pakpatel

                  Ya i know but what i do man..that's how they want ?

                  Peter

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #9

                  A good app starts with good solid requirements. Your customers are not software developers. They have no concept of what is and isn't best practice. If the customer wants something that is known to be bad practice, it's part of your job to hash this requirement out and make sure that the customer understands that this will affect the quality of the app and spell out what the potential pitfalls are, and have the customer sign off on the bad requirement. The last thing you need is to give the customer everything they wanted and them not give you what you wanted ($$$) because the app didn't do everything they envisioned it doing.

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007, 2008

                  D 1 Reply Last reply
                  0
                  • P pakpatel

                    In textbox.. when ever user write his address, He has to start with Numeric value then after all he can use what ever he want ? if he not use numreic value, then message come up. Can anyone help me with that? -Thanks

                    Peter

                    K Offline
                    K Offline
                    kaddim
                    wrote on last edited by
                    #10

                    Perhaps if you communicated to your client some more concrete examples... There are legitimate addresses that don't start with a number. Private roads sometimes are used Waverly Place Anytown, XX, 12345 Sometimes people spell out numbers as well: One Rockefeller Plaza Some begin with directions: West 106 Broadway As long as you're dealing with a small, known pool of addresses, you'll be OK. However, if you're soliciting general address input, I'd stay away from this rule. Just my 2 cents... Good luck!

                    1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      A good app starts with good solid requirements. Your customers are not software developers. They have no concept of what is and isn't best practice. If the customer wants something that is known to be bad practice, it's part of your job to hash this requirement out and make sure that the customer understands that this will affect the quality of the app and spell out what the potential pitfalls are, and have the customer sign off on the bad requirement. The last thing you need is to give the customer everything they wanted and them not give you what you wanted ($$$) because the app didn't do everything they envisioned it doing.

                      A guide to posting questions on CodeProject[^]
                      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                           2006, 2007, 2008

                      D Offline
                      D Offline
                      darkelv
                      wrote on last edited by
                      #11

                      Agree with Dave. If you give the customer exactly and literally what they wanted, you will find that in the end you have a system that is hard to maintain, with a lot of loop holes, and does not handle situations that did not occurs to the customer that it may happens, at that moment.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups