Where is the decimal point?

  • Thread starter Thread starter Tony Girgenti
  • Start date Start date
T

Tony Girgenti

Hello.

Working on a VS2005 SP1 Windows form program in .NET 2.0, on XP Pro, SP2.

I must be pretty stupid. I can't figure out how use decimal data in a table
where there is no decimal point. I populated the table with data from a
flat file that has a number like this "000001645000". Without the quotation
marks of course. The assumed decimal point is five digits from the right.
So that number shuould be 0000016.45000.

How do i use this decimal in a calculation as 16.45000. I'm not looking to
truncate any zeros, left or right, i just want to be able to use it as the
value it should be, 16.45. Also, i'm not looking to convert it to a string
as 16.45000. I know how to do that.

It is stored in the datatable as 1645000. I don't see a decimal point in
the table data.

Any help would be gratefully appreciated.

Thanks,
Tony
 
Hello.

Working on a VS2005 SP1 Windows form program in .NET 2.0, on XP Pro, SP2.

I must be pretty stupid. I can't figure out how use decimal data in a table
where there is no decimal point. I populated the table with data from a
flat file that has a number like this "000001645000". Without the quotation
marks of course. The assumed decimal point is five digits from the right.
So that number shuould be 0000016.45000.

How do i use this decimal in a calculation as 16.45000. I'm not looking to
truncate any zeros, left or right, i just want to be able to use it as the
value it should be, 16.45. Also, i'm not looking to convert it to a string
as 16.45000. I know how to do that.

It is stored in the datatable as 1645000. I don't see a decimal point in
the table data.

Any help would be gratefully appreciated.

Thanks,
Tony

If there is no decimal point in the data, and you're sure it will always be
5 digits from the right, you could divide your data by 100000 after you
import it to put the decimal point. Then you can use the numbers in your
calculations with a free hand
 
Hello Rad.

OK. That worked.

I'm loading this data from a flat file. Now, i need to write the data back
out to another flat file. How do i format the number so that it always has
the same number of digits in the flat file?

Each record should look like this "BMR617JV 000001645000+". Where the
number is "000001645000+". I need it to always be the same number of digits
in the flat file.

Thanks,
Tony
 
Hello Rad.

OK. That worked.

I'm loading this data from a flat file. Now, i need to write the data back
out to another flat file. How do i format the number so that it always has
the same number of digits in the flat file?

Each record should look like this "BMR617JV 000001645000+". Where the
number is "000001645000+". I need it to always be the same number of digits
in the flat file.

Thanks,
Tony

Hey Tony,

To lose the decimal points when writing to the file just do the reverse --
*multiply* each number by 100000
 
Tony,

As alternative, write to a "decimal" value where is told where the point is.

Cor
 
Back
Top