• Advertisement
Sign in to follow this  

[VB] Greater than or equal to and Less than and equal to if statements

This topic is 1656 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey there,

 

trying to create a simple application which can calculate quotes based on the size of a variable, but having a bit of trouble as I havnt touched Visual Basic in over 5 years.

 

So far I have this

        If width >= 1801 And <= 2000 Then
            price = 1458
        End If

is the width is equal to or larger than 1801 and the width is greater than or equal to 2000 then the price is 1458, although this is saying that the 2nd operator is infact an XML element?

 

Does anyone have an example of a working if statement like this that I can get an idea of?

 

Cheers

Share this post


Link to post
Share on other sites
Advertisement

Notice how when you said the sentence in English you used "width" twice. You most likely (I don't know anything about Visual Basic) need to do the same thing in code and say `width <= 2000'. Computers are notoriously bad at figuring out things from context.

Share this post


Link to post
Share on other sites

That makes sense, I am also lead to believe I can't use 'width' as it's a system variable

        If theWidth >= 1801 And theWidth <= 2000 Then
            price = 1458
        End If

This seems to be working fine now, cheers

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement