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. Visual Basic
  4. New to Visual Basic

New to Visual Basic

Scheduled Pinned Locked Moved Visual Basic
questionhelp
8 Posts 7 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 Offline
    P Offline
    PoddyCo
    wrote on last edited by
    #1

    Hi, :-\ The scenerio: I would like the user to enter data into a text box, before clicking continue. If the data is numeric then the program should assign it to a variable and continue as it should, but if the data is not numeric, the program should respond with a message alerting the user of this mistake. The question: Is there anyone who can either help me directly or atleast point me in the right direction to work it out myself? Any assistance in this matter would be greatly appreciated.

    L D J C P 7 Replies Last reply
    0
    • P PoddyCo

      Hi, :-\ The scenerio: I would like the user to enter data into a text box, before clicking continue. If the data is numeric then the program should assign it to a variable and continue as it should, but if the data is not numeric, the program should respond with a message alerting the user of this mistake. The question: Is there anyone who can either help me directly or atleast point me in the right direction to work it out myself? Any assistance in this matter would be greatly appreciated.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Use the TryParse()[^] method to check the string from the text box and take action accordingly.

      Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

      1 Reply Last reply
      0
      • P PoddyCo

        Hi, :-\ The scenerio: I would like the user to enter data into a text box, before clicking continue. If the data is numeric then the program should assign it to a variable and continue as it should, but if the data is not numeric, the program should respond with a message alerting the user of this mistake. The question: Is there anyone who can either help me directly or atleast point me in the right direction to work it out myself? Any assistance in this matter would be greatly appreciated.

        D Offline
        D Offline
        DaveAuld
        wrote on last edited by
        #3

        Further to what Richard has said take a look at the following textbox events; textchange, validation or even the lost focus event. You can use these events to automatically trigger your checking code without the user having to do anything.

        Dave Find Me On: Web|Facebook|Twitter|LinkedIn


        Folding Stats: Team CodeProject

        1 Reply Last reply
        0
        • P PoddyCo

          Hi, :-\ The scenerio: I would like the user to enter data into a text box, before clicking continue. If the data is numeric then the program should assign it to a variable and continue as it should, but if the data is not numeric, the program should respond with a message alerting the user of this mistake. The question: Is there anyone who can either help me directly or atleast point me in the right direction to work it out myself? Any assistance in this matter would be greatly appreciated.

          J Offline
          J Offline
          JR212
          wrote on last edited by
          #4

          Is a numuricupdown not beter. it can only contain nummeric values

          1 Reply Last reply
          0
          • P PoddyCo

            Hi, :-\ The scenerio: I would like the user to enter data into a text box, before clicking continue. If the data is numeric then the program should assign it to a variable and continue as it should, but if the data is not numeric, the program should respond with a message alerting the user of this mistake. The question: Is there anyone who can either help me directly or atleast point me in the right direction to work it out myself? Any assistance in this matter would be greatly appreciated.

            C Offline
            C Offline
            coded007
            wrote on last edited by
            #5

            You can you on keypress event of text box. Handle e.keychar not a character and display msg.

            1 Reply Last reply
            0
            • P PoddyCo

              Hi, :-\ The scenerio: I would like the user to enter data into a text box, before clicking continue. If the data is numeric then the program should assign it to a variable and continue as it should, but if the data is not numeric, the program should respond with a message alerting the user of this mistake. The question: Is there anyone who can either help me directly or atleast point me in the right direction to work it out myself? Any assistance in this matter would be greatly appreciated.

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

              Thanks people:thumbsup:, not able to test any of suggestions as my computer is down :sigh: , but when I get a chance, I will let you know how I get on. Thanks again for the help.

              1 Reply Last reply
              0
              • P PoddyCo

                Hi, :-\ The scenerio: I would like the user to enter data into a text box, before clicking continue. If the data is numeric then the program should assign it to a variable and continue as it should, but if the data is not numeric, the program should respond with a message alerting the user of this mistake. The question: Is there anyone who can either help me directly or atleast point me in the right direction to work it out myself? Any assistance in this matter would be greatly appreciated.

                E Offline
                E Offline
                elgaabeb
                wrote on last edited by
                #7

                Hi, a snippets is on this page. Validation text box on VB[^] Best regards. EL GAABEB.

                1 Reply Last reply
                0
                • P PoddyCo

                  Hi, :-\ The scenerio: I would like the user to enter data into a text box, before clicking continue. If the data is numeric then the program should assign it to a variable and continue as it should, but if the data is not numeric, the program should respond with a message alerting the user of this mistake. The question: Is there anyone who can either help me directly or atleast point me in the right direction to work it out myself? Any assistance in this matter would be greatly appreciated.

                  D Offline
                  D Offline
                  daveh6045
                  wrote on last edited by
                  #8

                  validate each keypress on the textbox

                  Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress

                  If InStr("0123456789", e.KeyChar) < 1 Then
                      e.Handled = True
                  
                  End If
                  

                  End Sub

                  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