i need to check whether a demical is 0 through 49.99 or 50 through 99.99 or 100 through 199.99 or greater than 200. i am trying to do this with select case, but i am not sure of the syntax. please help!
相关问题
- 'System.Threading.ThreadAbortException' in
- how to use special characters like '<'
- C# to VB - How do I convert this anonymous method
- Scaling image for printing
- visual basics equal to or greater than
相关文章
- vb.net 关于xps文件操作问题
- Checking for DBNull throws a StrongTypingException
- Using the typical get set properties in C#… with p
- Load a .NET assembly from the application's re
- C# equivalent of VB DLL function declaration (Inte
- What other neat tricks does the SpecialNameAttribu
- Automatically install updates with ClickOnce deplo
- Resetting Experimental instance of Visual Studio
Why don't you try if/then/else? They are equivalent, and I am not sure if case statement in VBasic can handle non-integers values.
this(below) would go into case else
this(below) will go into case 1 to 1.49
this(below) will go into case 1.5 to 2
other way of doing it: From here
and maybe this too:
This is how I would do it, I use the # to explicitly state the values are of type "double".
I came across this question but these responses still allow too many things to fall in the gaps.
Instead it is better to reverse the order, to avoid having to specify superfluous decimal places in an effort to close the gaps.
The
Select Case
statement only follows only the first true case so even though subsequent cases may also be true, they will be bypassed if caught by an earlier case.AlbertEin is onto something, but to do integer division like that in VB.Net you have to write it like this:
Notice the backwards division symbol. From there you can
Select Case range
.But really, jvanderh's answer most expresses what you want to do, because it allows for easy addition of cases in the future that don't break on a multiple of 50 and don't require future maintainers to follow the math or know about the \ operator.