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. Vb.net text box

Vb.net text box

Scheduled Pinned Locked Moved Visual Basic
csharphelp
8 Posts 3 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.
  • R Offline
    R Offline
    rrrriiizz
    wrote on last edited by
    #1

    Hi, i have wriiten one simple code for value Checking but the code is working for a single digit number for double digit it doesnot work, i dont no why. Please help me reg this. My simple code is

    If (txtqty.Text > "2") Then
    btn3.Visible = False
    btn3.Enabled = False
    txtp3.Enabled = False
    txtr3.Enabled = False
    Else
    btn3.Visible = True
    btn3.Enabled = True
    txtp3.Enabled = True
    txtr3.Enabled = True
    End If

    C T 2 Replies Last reply
    0
    • R rrrriiizz

      Hi, i have wriiten one simple code for value Checking but the code is working for a single digit number for double digit it doesnot work, i dont no why. Please help me reg this. My simple code is

      If (txtqty.Text > "2") Then
      btn3.Visible = False
      btn3.Enabled = False
      txtp3.Enabled = False
      txtr3.Enabled = False
      Else
      btn3.Visible = True
      btn3.Enabled = True
      txtp3.Enabled = True
      txtr3.Enabled = True
      End If

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

      I would suggest you buy a basic VB book and read it. You're doing a string comparison, and you need instead to convert the string to a number.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      • R rrrriiizz

        Hi, i have wriiten one simple code for value Checking but the code is working for a single digit number for double digit it doesnot work, i dont no why. Please help me reg this. My simple code is

        If (txtqty.Text > "2") Then
        btn3.Visible = False
        btn3.Enabled = False
        txtp3.Enabled = False
        txtr3.Enabled = False
        Else
        btn3.Visible = True
        btn3.Enabled = True
        txtp3.Enabled = True
        txtr3.Enabled = True
        End If

        T Offline
        T Offline
        Tom Deketelaere
        wrote on last edited by
        #3

        Since I'm in a good mood:

        if isnumeric(txtqty.text) andalso integer.parse(txtqty.text) > 2 then
        'do stuff here
        else
        'do stuff here
        end if

        should do it But take CG's advice and go back to reading a book first, this is very basic stuff

        C R 2 Replies Last reply
        0
        • T Tom Deketelaere

          Since I'm in a good mood:

          if isnumeric(txtqty.text) andalso integer.parse(txtqty.text) > 2 then
          'do stuff here
          else
          'do stuff here
          end if

          should do it But take CG's advice and go back to reading a book first, this is very basic stuff

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

          Of course, this code will explode if the user types in anything other than numbers. :-)

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          T 1 Reply Last reply
          0
          • C Christian Graus

            Of course, this code will explode if the user types in anything other than numbers. :-)

            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

            T Offline
            T Offline
            Tom Deketelaere
            wrote on last edited by
            #5

            :confused: Why? Just tested it and it doesn't Read the code carefully CG. (tip: 'isnumeric') And even if it does a nice explosion now and then isn't that bad ;P

            C 1 Reply Last reply
            0
            • T Tom Deketelaere

              Since I'm in a good mood:

              if isnumeric(txtqty.text) andalso integer.parse(txtqty.text) > 2 then
              'do stuff here
              else
              'do stuff here
              end if

              should do it But take CG's advice and go back to reading a book first, this is very basic stuff

              R Offline
              R Offline
              rrrriiizz
              wrote on last edited by
              #6

              sir, I try this, txtqty as one text box in its text change property i have checked if not is numeric (txtqty.text) then Msg box ( "Please Enter only numeric values") txtqty.setfocus End if After that while Checking the values in Qty Box through a button click with below code, it was not working, Am not a programming professional, because of my own interest am trying to develop some small projects. dont mistaken me,thanks For your help

              T 1 Reply Last reply
              0
              • T Tom Deketelaere

                :confused: Why? Just tested it and it doesn't Read the code carefully CG. (tip: 'isnumeric') And even if it does a nice explosion now and then isn't that bad ;P

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

                Ooops - you are right. *blush*

                Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

                1 Reply Last reply
                0
                • R rrrriiizz

                  sir, I try this, txtqty as one text box in its text change property i have checked if not is numeric (txtqty.text) then Msg box ( "Please Enter only numeric values") txtqty.setfocus End if After that while Checking the values in Qty Box through a button click with below code, it was not working, Am not a programming professional, because of my own interest am trying to develop some small projects. dont mistaken me,thanks For your help

                  T Offline
                  T Offline
                  Tom Deketelaere
                  wrote on last edited by
                  #8

                  K so you did the check so now instead of txtqty.text>"2" use integer.parse(txtqty.text) > 2 Your code is comparing a string you can't use that for the > < operators

                  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