integer
-
Hello, I have following code
Dim i As Integer i = 3/2
from my knowleadge, if you set the variable as an integer, when you divide, (from the example) suppose to be i= 1 but right now i=2 because the answer i = 1.5 and automatically set the i to 2 . why is that? I don't want the decimal numbers, I want the integer. How can I fix that problem Thanks -
Hello, I have following code
Dim i As Integer i = 3/2
from my knowleadge, if you set the variable as an integer, when you divide, (from the example) suppose to be i= 1 but right now i=2 because the answer i = 1.5 and automatically set the i to 2 . why is that? I don't want the decimal numbers, I want the integer. How can I fix that problem ThanksFrom my knowlage of vb, when it preforms type casting for you, it will always try to round. More information on this in the MSDN under cint(). If you just want to truncate your number, in this case either fix() or int() will do the job, however there is a subtle difference (regarding negetives) between them. Try:
i = int(3/2)
Now i = 1 -
From my knowlage of vb, when it preforms type casting for you, it will always try to round. More information on this in the MSDN under cint(). If you just want to truncate your number, in this case either fix() or int() will do the job, however there is a subtle difference (regarding negetives) between them. Try:
i = int(3/2)
Now i = 1 -
Hello, I have following code
Dim i As Integer i = 3/2
from my knowleadge, if you set the variable as an integer, when you divide, (from the example) suppose to be i= 1 but right now i=2 because the answer i = 1.5 and automatically set the i to 2 . why is that? I don't want the decimal numbers, I want the integer. How can I fix that problem Thanks