VB: Round up decimal value by truncate floating point
So I was searching for a method to get the integer value from a floating number but found a quick workaround towards the problem. Below is what I have come up with:
function convertInt(value as double) as integer
dim arrayNo
arrayNo=Split(value,”.”)
convertInt=arrayNo(0)
end function
I believe the above function code is self explainatory. Anyone have a better way or suggestion?
Written by admin on August 21st, 2007 with
2 comments.
Read more articles on Personal and Programming.
- [+] Digg: Feature this article
- [+] Del.icio.us: Bookmark this article
- [+] Furl: Bookmark this article
#1. February 23rd, 2009, at 11:04 PM.
(Assumes VB6 or VBA)
Any reason you would not use the native cint/int/fix functions?