Problem with final result
Hi to all:
THis code extract a value from a table to a var...
Code:
Dim var_IES_fornecedores as double = 0
For Each dRow In ds.Tables("Tabelavalor").Rows
If dRow("numeroconta").Equals("221") Then
If dRow("acumuladosdebito").Equals("0,00") Then
Else
Var_IES_Fornecedores -= FormatNumber(dRow("acumuladosdebito"), 2)
End If
End If
If dRow("numeroconta").Equals("221") Then
If dRow("acumuladoscredito").Equals("0,00") Then
Else
Var_IES_Fornecedores += FormatNumber(dRow("acumuladoscredito"), 2)
End If
End If
Next
the Var_IES_Fornecedores return a value = 174526.852222225
This is the problem...the numbers after the period should be just 2 and not a lot of numbers...
everythin wrong with the code?
Thanks
Re: Problem with final result
Once you get that Double value, you can do whatever you want with it. You can use the Math.Round function to round it to 2 decimal places if that is what you desire. If all you want to do is display that value to 2 decimal places, you can use the ToString method:
Code:
Dim value = 151592.124124124R
Dim text = value.ToString("0.00")
Console.WriteLine(text)
Output:
Re: Problem with final result
hi:
yes works with .tostring
Thanks