Limit parameter acceptable values
-
Hello all I want to create a sub that takes an integer as a parameter like so:
public sub foo(inNumber as integer) ... end sub
what I want is, at design time, to limit the range of inNumber. for example, if the acceptable range is [2..5] thenfoo(1)
would not compile butfoo(3)
would compile correctly How would I go about doing this? /jason -
Hello all I want to create a sub that takes an integer as a parameter like so:
public sub foo(inNumber as integer) ... end sub
what I want is, at design time, to limit the range of inNumber. for example, if the acceptable range is [2..5] thenfoo(1)
would not compile butfoo(3)
would compile correctly How would I go about doing this? /jasonThere isnt a way to do that. Use a select case statement inside your sub.
ZeePain! wrote:
This seems like one of those programs that started small, grew incrementally, building internal pressure, and finally barfed all over its source code sneakers. Or something.
-
Hello all I want to create a sub that takes an integer as a parameter like so:
public sub foo(inNumber as integer) ... end sub
what I want is, at design time, to limit the range of inNumber. for example, if the acceptable range is [2..5] thenfoo(1)
would not compile butfoo(3)
would compile correctly How would I go about doing this? /jasonYou're trying to limit a runtime value at design time. This can only be done by the designer including code to validate the parameters at runtime. AFAIK the standard tools and addon third party tools don't do this. You'll need to add the code to your functions manually and trap any errors. ...Steve