Cor
Sun Mar 18 06:44:24 CDT 2007
Tony,
As alternative, write to a "decimal" value where is told where the point is.
Cor
"Rad [Visual C# MVP]" <nospam@nospam.com> schreef in bericht
news:rkay5vvrqyru$.dlg@thinkersroom.com...
> On Sat, 17 Mar 2007 06:09:55 -0400, Tony Girgenti wrote:
>
>> 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
>>
>> "Rad [Visual C# MVP]" <nospam@nospam.com> wrote in message
>> news:e21cr904qxgo$.dlg@thinkersroom.com...
>>> On Fri, 16 Mar 2007 20:21:31 -0400, Tony Girgenti wrote:
>>>
>>>> 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
>>>
>>> --
>>> Bits.Bytes
>>>
http://bytes.thinkersroom.com
>
> Hey Tony,
>
> To lose the decimal points when writing to the file just do the reverse --
> *multiply* each number by 100000
> --
> Bits.Bytes
>
http://bytes.thinkersroom.com