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. input box

input box

Scheduled Pinned Locked Moved Visual Basic
question
4 Posts 4 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.
  • A Offline
    A Offline
    ali kanju
    wrote on last edited by
    #1

    as inputbox is for inputting strings so can i use it to input integer data as well and how can i do it.if anyone has solution plz reply.

    C B M 3 Replies Last reply
    0
    • A ali kanju

      as inputbox is for inputting strings so can i use it to input integer data as well and how can i do it.if anyone has solution plz reply.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You can force a textbox to take ints only by handling the char event, and using char.IsDigit to set HAndled to true for non numbers. Christian Graus - Microsoft MVP - C++

      1 Reply Last reply
      0
      • A ali kanju

        as inputbox is for inputting strings so can i use it to input integer data as well and how can i do it.if anyone has solution plz reply.

        B Offline
        B Offline
        Briga
        wrote on last edited by
        #3

        if you mean how to get an interger out of it than it's really basic: a = int(inputbox("Enter number")) if you rather want to know how to validate and check against an integer than it's a different story. AFAIK you can't do it with an inputbox but you can accomplish it through a textbox in a form as stated in the reaply before (and maybe have a look at the "validate" function).

        1 Reply Last reply
        0
        • A ali kanju

          as inputbox is for inputting strings so can i use it to input integer data as well and how can i do it.if anyone has solution plz reply.

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

          You cannot do that to an InputBox since it runs modally. You have two options: 1)Design your own frmInputBox and run it modally to get the input. 2)Just get the input value as strting, then use the Val() function to convert the input value to number and check if it really was a number.

          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