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. if statement

if statement

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

    how can i use the 'or' function. I want that if the user didn't enter a specific username ex: liba or demel or pufta! how can i do this?? i am using this but it aint working: If text = "pufta" Or "demel" Then MessageBox.Show("You have registered for the program. Now close the registration menu and start using the program. Have Fun!!", _ "Registration Completed", MessageBoxButtons.OK, MessageBoxIcon.Information) s.WriteLine(txtbox.Text) s.Close() End If Adrian

    C S 2 Replies Last reply
    0
    • A ADY007

      how can i use the 'or' function. I want that if the user didn't enter a specific username ex: liba or demel or pufta! how can i do this?? i am using this but it aint working: If text = "pufta" Or "demel" Then MessageBox.Show("You have registered for the program. Now close the registration menu and start using the program. Have Fun!!", _ "Registration Completed", MessageBoxButtons.OK, MessageBoxIcon.Information) s.WriteLine(txtbox.Text) s.Close() End If Adrian

      C Offline
      C Offline
      chrismerrill
      wrote on last edited by
      #2

      Or doesn't work like that. Below is how or works. if text = "pufta" or text = "demel" then 'do stuff end if if case doesn't matter (D and d are the same), I would use the following: if string.compare(text, "pufta", true) = 0 _ or string.compare(text, "demel", true) = 0 then 'do stuff end if

      1 Reply Last reply
      0
      • A ADY007

        how can i use the 'or' function. I want that if the user didn't enter a specific username ex: liba or demel or pufta! how can i do this?? i am using this but it aint working: If text = "pufta" Or "demel" Then MessageBox.Show("You have registered for the program. Now close the registration menu and start using the program. Have Fun!!", _ "Registration Completed", MessageBoxButtons.OK, MessageBoxIcon.Information) s.WriteLine(txtbox.Text) s.Close() End If Adrian

        S Offline
        S Offline
        Suman Singh
        wrote on last edited by
        #3

        If **textbox1.**text = "pufta" Or "demel" Then MessageBox.Show("You have registered for the program. Now close the registration menu and start using the program. Have Fun!!", _ "Registration Completed", MessageBoxButtons.OK, MessageBoxIcon.Information) s.WriteLine(txtbox.Text) s.Close() End If I think you were missing the bold part....

        A 1 Reply Last reply
        0
        • S Suman Singh

          If **textbox1.**text = "pufta" Or "demel" Then MessageBox.Show("You have registered for the program. Now close the registration menu and start using the program. Have Fun!!", _ "Registration Completed", MessageBoxButtons.OK, MessageBoxIcon.Information) s.WriteLine(txtbox.Text) s.Close() End If I think you were missing the bold part....

          A Offline
          A Offline
          ADY007
          wrote on last edited by
          #4

          but TEXT is a variable!

          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