I am trying to figure out how to test two conditions in a Case Statement.
Select Case txtWeight.Text
Case Is <= 2
decShippingCost = (decShipping2 + (decShipping2 * 0.26))
Case Is > 2 and <= 4
decShippingCost = (decShipping4 + (decShipping4 * 0.026))
I cannot get AND to work, what am I doing wrong?
Select Case txtWeight.Text
Case Is <= 2
decShippingCost = (decShipping2 + (decShipping2 * 0.26))
Case 3 to 4
decShippingCost = (decShipping4 + (decShipping4 * 0.026))
End Select
Or maybe this if you want to catch 2.5 as >2.
Select Case txtWeight.Text
Case Is <= 2
decShippingCost = (decShipping2 + (decShipping2 * 0.26))
Case 2.01 to 4
decShippingCost = (decShipping4 + (decShipping4 * 0.026))
End Select
You don't need to check for a weight greater than two in the second Case. If it's not greater than two, then it will have entered the first case. So you can simplify it to this:
Select Case txtWeight.Text
Case Is <= 2
decShippingCost = (decShipping2 + (decShipping2 * 0.26))
Case Is <= 4
decShippingCost = (decShipping4 + (decShipping4 * 0.026))
End Select
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With