Convert Double to Integers

How to pass a column with Double values ​​to integers

use cint().

double type - x = 15.86
interger type - y = cint(x)
writeline(y.toString)

output will be 15

Tengo esta Sentencia Convert.ToInt32(row(“Promedio de Salida”).ToString)

pero genera error

Try as

Convert.ToInt32(double.parse(row(“Promedio de Salida”).ToString)) will work.

2 Likes

WOW YOU ARE GREAT YOU WORK PERFECT THANK :sonriendo:

1 Like

hello I can bother you is I’m trying to multiply the column MUPAverage that was the one that was converted to integers with another table in the same file also of integer format but I get an error this is the command I use not if you can help me

Convert.ToString(Convert.ToInt32(row(“Unidad”).ToString)* Convert.ToInt32(row(“MUPromedio”).ToString))

what is the type of row(“Unidad”) and row(“MUPromedio”) or give me example values

@Theepan, what does the double.parse does? I can’t understand what the parse works

Hello these are the two columas that I must multiply the Uniadad with the average Integer that is the table that I converted to integers with your help

Preformatted text

I was intent this way

Convert.ToString(Convert.ToInt32(row(“Unidad”).ToString)* Convert.ToInt32(row(“MUPromedio”).ToString))

This will work. However don’t assign to Row Items. Just assign to string variable and then add to Row.

It would be this way
change
row (“MUP average”)

by a variable example MUP average
and I leave the same operation
Convert.ToString (Convert.ToInt32 (row (“Unit”). ToString) * Convert.ToInt32 (row (“MUPAverage”). ToString))

Yes. You can do that

I modified it with a generic variable but when I execute it fails
I do not know if you can check it

Opercacion.xaml (9.9 KB)

image

creo que deberias usar esta expression en la operacion:
Convert.ToInt32(row(“Unidad”).ToString)* Convert.ToInt32(row(“MUPromedio”).ToString) y declara MU promedio Int32 no GenericValue, o que tipo de dato debe ser MUPromedio?

It must be of integer type in fact already try to place the variable of that type but it generates me an error since it can not perform the converse from string to integer

(Int32.Parse(row(“Unidad”).ToString)* Int32.parse(row(“MUPromedio”).ToString).toString

Hi, I did it this way and it worked for me. Thank you very much for your help. You’re great.

(Convert.ToString(Convert.ToInt32(row(“Unidad”).ToString)* Convert.ToDouble(row(“Promedio de Salida”).ToString)))

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.