Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7690825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:29:06+00:00 2026-05-31T20:29:06+00:00

Am I just being blind or does this if statement genuinely not do what

  • 0

Am I just being blind or does this if statement genuinely not do what it’s meant to?

Dim textSample as String = "F"
If Not textSample = "D" Or Not textSample = "E" Or Not textSample = "F" Then
    MessageBox.Show("False")
End If

This displays the message box even though textSample is one of the letters. In my eyes that if statement should see that textSample is one of those letters and skip it, whereas if it was Z it would “Not” be equal to any of those and would therefore show the message box.

Why does it step into the if statement?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:29:07+00:00Added an answer on May 31, 2026 at 8:29 pm

    cond1 Or cond2 Or ... Or condn is true if and only if at least one of the given conditions are true. In your case it is always the case that at least one of the conditions is true (in fact at least two of the conditions will be true in each case). For example if textSample is "D" then the condition Not textSample = "E" and the condition Not textSample = "F" will be true. So the whole condition will be true.

    Long story short: Use And instead of Or.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm perhaps being a bit lazy asking this here, but I'm just getting started
I'm not blind, I just want to have a way to have my Windows
I'm used to thinking of member functions as just being a special case of
I understand that Exceptions are for exceptional cases [a], but besides just being repeated
I just saw a article on Swing being used in JavaFX. How can an
Just starting to explore the 'wonders' of regex. Being someone who learns from trial
Scott Gu just posted about a new set of charting controls being distributed by
Is there a reason being list.append evaluating to false? Or is it just the
I need to catch the HTML of a ASP.NET just before it is being
Is there a valid reason for there not being a method to return the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.