Results 1 to 4 of 4

Thread: Wanna help a sick man? Positive to negative.(Resolved)

  1. #1

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    Wanna help a sick man? Positive to negative.(Resolved)

    Ok guys bare with me here. Im am very ill right now and have some last minute work I HAVE to get done. So I usually could get this donme on my own, but I am so sluggish I cant think.

    Ok I have a dollar amount coming from a text file. Looks like this

    000001344{

    I have already done the conversion to make that 00000134.40 (The { symbol determines the 0, its a mainframe thing)

    Anyway, there is another part of the recrod that determines it should be turned into negative. Main problem is, this has to be retained as a string value because the new amount is going back into another text file, plus it has to be formated with any leading zeros. So I cant simply convert to a numeric value and multiply by -1 because zeros have to be retained and some more added


    The final format has to be 12 characters long, including the negative symbol and decimal point.

    Anyone want to help me out for a change?
    Last edited by Cander; Nov 24th, 2003 at 11:46 AM.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Can't you just custom format after its a number? Something like this:
    VB Code:
    1. Dim num As Single = Single.Parse("00000134.40")
    2.         num = num * -1
    3.         MsgBox(num.ToString("000000000.00;-00000000.00"))

  3. #3

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    yeah I found it out a couple minutes ago. That is pretty much what I did. My brain kind of blocked out the Format function

    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I'm the exact same way when I'm sick.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width