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. Simple problem

Simple problem

Scheduled Pinned Locked Moved Visual Basic
helpcsharpcssasp-nettutorial
5 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.
  • I Offline
    I Offline
    ivanji
    wrote on last edited by
    #1

    :((Hello everyone. I've got a very small problem, for most of you this could be very stupid, but hey I'm new in the programming world. I need to create a small program using VB 6.0 but I have a small problem with it. Here it goes, I have a form with a command button, when clicked is gonna open an inputbox asking for a value, but I need to say that if the value is less than 45 please display a word, if it's equal or greater than 45 but less than 60 display a different word, if it's equal or greater than 60 but less than 70 display another word and if it's equal or greater than 70 but less than 80 display other word. I've got something like this in the code: dim weight as single weight = inputBox("Please type weight...") If weight < 45 then label.Caption = "reject" Else If weight >= 45 ... HERE IS WHERE I HAVE THE PROBLEM, i DON'T KNOW HOW TO WRITE THIS STATEMENT WITH the two values label.Caption = "Small" Else If weigh ...the same ... label.caption = "medium" Else (...) End if End if End if Please help me!!! thanks very much for any help ASP.NET capo

    N 1 Reply Last reply
    0
    • I ivanji

      :((Hello everyone. I've got a very small problem, for most of you this could be very stupid, but hey I'm new in the programming world. I need to create a small program using VB 6.0 but I have a small problem with it. Here it goes, I have a form with a command button, when clicked is gonna open an inputbox asking for a value, but I need to say that if the value is less than 45 please display a word, if it's equal or greater than 45 but less than 60 display a different word, if it's equal or greater than 60 but less than 70 display another word and if it's equal or greater than 70 but less than 80 display other word. I've got something like this in the code: dim weight as single weight = inputBox("Please type weight...") If weight < 45 then label.Caption = "reject" Else If weight >= 45 ... HERE IS WHERE I HAVE THE PROBLEM, i DON'T KNOW HOW TO WRITE THIS STATEMENT WITH the two values label.Caption = "Small" Else If weigh ...the same ... label.caption = "medium" Else (...) End if End if End if Please help me!!! thanks very much for any help ASP.NET capo

      N Offline
      N Offline
      NetPointerIN
      wrote on last edited by
      #2

      If weight >= 45 And weight<60 Then 'Value between 44 & 60 End if

      R 1 Reply Last reply
      0
      • N NetPointerIN

        If weight >= 45 And weight<60 Then 'Value between 44 & 60 End if

        R Offline
        R Offline
        Ray Cassick
        wrote on last edited by
        #3

        Actually to get a value between 45 and 60 you need to write:

        If weight >= 45 And weight <= 60 Then
        'Value between 44 & 60
        End If

        If you leave out the = in the second '<= 60' you only get the values between 45 and 59.


        Paul Watson wrote: "At the end of the day it is what you produce that counts, not how many doctorates you have on the wall." George Carlin wrote: "Don't sweat the petty things, and don't pet the sweaty things." Jörgen Sigvardsson wrote: If the physicists find a universal theory describing the laws of universe, I'm sure the asshole constant will be an integral part of that theory.


        U 1 Reply Last reply
        0
        • R Ray Cassick

          Actually to get a value between 45 and 60 you need to write:

          If weight >= 45 And weight <= 60 Then
          'Value between 44 & 60
          End If

          If you leave out the = in the second '<= 60' you only get the values between 45 and 59.


          Paul Watson wrote: "At the end of the day it is what you produce that counts, not how many doctorates you have on the wall." George Carlin wrote: "Don't sweat the petty things, and don't pet the sweaty things." Jörgen Sigvardsson wrote: If the physicists find a universal theory describing the laws of universe, I'm sure the asshole constant will be an integral part of that theory.


          U Offline
          U Offline
          User 572417
          wrote on last edited by
          #4

          Don't you guys just live for the simple questions? :laugh:

          I 1 Reply Last reply
          0
          • U User 572417

            Don't you guys just live for the simple questions? :laugh:

            I Offline
            I Offline
            ivanji
            wrote on last edited by
            #5

            Thanks you guys you people are very kind, Thanks, that's one part of an assignment that is due today. I'm very happy thanks to you, I owe u heaps! But now I need more help PLEASE; it's from the same exercise. I need to make a loop until the value 0 is input, then print the total number of items weighted. for that i created a variable called counter as int. dim counter as integer Counter = 0 do until weight = 0 Counter = counter + 1 Loop weight = inputbox(...) (...code you guys gave me goes here) Loop End If (...) When I try to run it I get a runtime error '6', Overflow, but I have no idea what I'm doing wrong, please give a hand with that THANKS AGAIN! Cheers, IJ:-D ASP.NET capo

            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