hautzenroeder1
11 years agoOccasional Contributor
VB Select Case issue
I am optimizing a lot of my If...Then...Else... statements using Select Case.
TestComplete supports:
Select Case {value}
Case 1 ....
Case 2 ...
etc
End Select
Visual Basic allows the option of having:
Case 1 to 10
Case 11 to 12
etc
However, in Test Complete, this throws an error.
Any suggestions?
This would save a lot of identical Case 1, Case 2, etc coding.
TestComplete supports:
Select Case {value}
Case 1 ....
Case 2 ...
etc
End Select
Visual Basic allows the option of having:
Case 1 to 10
Case 11 to 12
etc
However, in Test Complete, this throws an error.
Any suggestions?
This would save a lot of identical Case 1, Case 2, etc coding.
- This is not a limitation of TestComplete but is instead a limitation of the VBscript language, which is not the same as Visual Basic.
In the example you provided where value has a range of 1 to 12, you could do the following:
If (value <= 12) Then
Select Case value
Case 11, 12
...do something here...
Case Else
...do something here...
End Select
Else
...do something else...
End If