|
-
May 23rd, 2013, 04:53 PM
#9
Re: In between numbers. Help.
Note that AndAlso should always be used in place of And unless you are doing bit manipulation. AndAlso is more efficient. OrElse should be used in place of Or, too. Take a look at the documentation to see why, as there are some odd (and very rare) circumstances where you might want to use And rather than AndAlso other than for bit manipulations.
Another point is that CInt is going to throw an exception if the textbox is empty, or otherwise is not an integer. Using Integer.TryParse is the only safe way to perform the conversion if there is any chance that the textbox doesn't hold a number. If the text is entered by a user, then there is always a chance they will get it wrong, and if the text is not entered by a user, then a label would be better than a textbox. However, Integer.TryParse is not a drop-in replacement for CInt, so you'd have to look it up to see how it is different.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|