Reputation: 1342
I'm trying to do Integer division () by 0.25 but VB is telling me I tried to divide by zero, I also tried dividing by (1/4).
This is my snippet
AmountLeft = Remainder \ 0.25
lblQuartersAmount.Text = AmountLeft
Upvotes: 3
Views: 1656
Reputation: 225164
You can't do integer division by a non-integer; just truncate and cast it afterwards.
AmountLeft = CInt(Math.Truncate(Remainder / 0.25))
And what's wrong with * 4
? =)
Upvotes: 2