How do I extend a range in a Select Case Statement. It’s seems that it would be Simple but I’m making it complicated. Also my iRange calculates to a negative integer. I have to change it to a positive integer. This is a way that I though I could pull it off but it does not work. Forgive me for not indenting the code there has been a lot of changes to the Forum posting editor since I have last been here. It used to have code formatting.
Thank You
Dim iRange As Integer
Dim iExtend As Integer
iExtend = -2
iExtend = -Extend
Select Case iRange
Case 1 to 11 + -(iExtend)
MessageBox("Extend Range 1 to 13 ")
Case 12 to 24
MessageBox(“12 to 24 Range”)
End Select
I see how i made it confusing with the negative integer. I made a correction in the code to turn it into a positive integer. I’m trying to extend the range from (1 to 11) to (1 to 11 + (iExtend)) or 1 to 13. (Extend = 2) If that makes any sense.
I just tried it again and it worked. Somehow the Xojo intellisense was throwing a syntax error. I think it was the way I was using the parenthesis. I better take a break. Thanks guys for the help.
Use another variable to avoid confusions and better to use the Abs function instead of Negate the value :
Dim iRange As Integer = 12
Dim iExtend As Integer
Dim iExtended As Integer
iExtend = -2
iExtend = abs(iExtend)
iExtended = 11 + iExtend
Select Case iRange
Case 1 To iExtended
MessageBox("Extend Range 1 to 13 ")
Case 12 To 24
MessageBox("12 To 24 Range")
End Select