TextBox numerical values

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rodger

    TextBox numerical values

    Hi all,

    how do I set a Textbox to only accept numerical values in vb .net

    many thanks

    rodger

  • Mr Utkal Ranjan Pradhan

    #2
    Re: TextBox numerical values

    On Text Box Key Press event procedure write

    if Not Instr(1,"123456 7890",chr$(KeyA scii,0) > 0 or KeyAscii = 8) then
    KeyAscii=0

    Mr Utkal Ranjan, New Delhi.


    Comment

    • rodger

      #3
      Re: TextBox numerical values

      I am not sure the NumericUpDown list is what I am looking for,

      as what I have is a simple Textbox, and I just want to ensure that only
      numbers are entered, (later they are picked up by a formula)

      on further research i have found
      TextBox1.Numeri c = true

      for VB

      so maybe there is an equivalent for VB .net?


      Herfried K. Wagner [MVP] wrote:[color=blue]
      > * rodger <pat@myisland.s pam> scripsit:
      >[color=green]
      >>how do I set a Textbox to only accept numerical values in vb .net[/color]
      >
      >
      > Use a NumericUpDown control instead.
      >[/color]

      Comment

      • rodger

        #4
        Re: TextBox numerical values

        I am not sure the NumericUpDown list is what I am looking for,

        as what I have is a simple Textbox, and I just want to ensure that only
        numbers are entered, (later they are picked up by a formula)

        on further research i have found
        TextBox1.Numeri c = true

        for VB

        so maybe there is an equivalent for VB .net?


        Herfried K. Wagner [MVP] wrote:[color=blue]
        > * rodger <pat@myisland.s pam> scripsit:
        >[color=green]
        >>how do I set a Textbox to only accept numerical values in vb .net[/color]
        >
        >
        > Use a NumericUpDown control instead.
        >[/color]


        Comment

        • José Manuel Agüero

          #5
          Re: TextBox numerical values

          Hello, rodger:

          You may find useful the sample for the TextChanged event for the textbox:


          Regards.


          "rodger" <pat@myisland.s pam> escribió en el mensaje news:Oz1r7UDqDH A.976@tk2msftng p13.phx.gbl...
          | Hi all,
          |
          | how do I set a Textbox to only accept numerical values in vb .net
          |
          | many thanks
          |
          | rodger
          |

          Comment

          Working...