Results 1 to 3 of 3

Thread: ToString value for mexican pesos

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2010
    Posts
    7

    ToString value for mexican pesos

    I know that i use a "c" for American Currency is there a ToString value used for Mexican Pesos?

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: ToString value for mexican pesos

    "c" is currency... and is based on the local regional settings... so if your local region currency settings isn't Pesos... you'll have to simple format it yourself, as a number, with the appropriate currency symbol, thousands separator, and decimal notation.


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: ToString value for mexican pesos

    even if your local region isn't Mexico, you can still call up the mexican culture info and apply it, however I think you will find even that doesn't support "pesos" really.

    If I have ten dollars and 50 cents in USD, and I was going to represent that in code I would have

    Dim myMoney as Double = 10.50
    Dim myString as String = myMoney.ToString("C") 'produces $10.50

    Now if you were to call up the mexican culture

    Dim myMoney As Double = 10.5
    Dim mexicanCulture = System.Globalization.CultureInfo.CreateSpecificCulture("es-MX")
    Dim myString As String = myMoney.ToString("C", mexicanCulture)

    You are still going to get "$10.50" because as far as the programming language is concerned, you are just formatting the numeric value of 10.50 into a string with currency formatting applied. Peso and Dollar use the same symbol $. It isn't doing dollar to peso conversions, those aren't even values that stay static, the conversion rate between currencies is a constantly changing thing...

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