Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. InputLanguage

InputLanguage

Scheduled Pinned Locked Moved C#
question
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ali_reza_zareian
    wrote on last edited by
    #1

    How can textbox control to set the money format for input? I try to use cultureInfo but it doesn't work.

    System.Globalization.CultureInfo cultur = new System.Globalization.CultureInfo("fa-IR");
    InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(cultur);

    D 1 Reply Last reply
    0
    • A ali_reza_zareian

      How can textbox control to set the money format for input? I try to use cultureInfo but it doesn't work.

      System.Globalization.CultureInfo cultur = new System.Globalization.CultureInfo("fa-IR");
      InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(cultur);

      D Offline
      D Offline
      Dan Mos
      wrote on last edited by
      #2

      the text box doesn't do any automatically formats for the string/values. Format the string using string.Format() and then set the text to the text box. Or use a masked text box with a custom mask or... or something like:

      System.Globalization.CultureInfo cultur = new System.Globalization.CultureInfo("fa-IR");
      InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(cultur);

      decimal moneyvalue = 1921.39m;
      txextBox1.Text = String.Format("{0:C}", moneyvalue);//C from curency

      A 1 Reply Last reply
      0
      • D Dan Mos

        the text box doesn't do any automatically formats for the string/values. Format the string using string.Format() and then set the text to the text box. Or use a masked text box with a custom mask or... or something like:

        System.Globalization.CultureInfo cultur = new System.Globalization.CultureInfo("fa-IR");
        InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(cultur);

        decimal moneyvalue = 1921.39m;
        txextBox1.Text = String.Format("{0:C}", moneyvalue);//C from curency

        A Offline
        A Offline
        ali_reza_zareian
        wrote on last edited by
        #3

        I think you suggest string.format("C"). but my language is Persian and it's not for foreign language.

        D 1 Reply Last reply
        0
        • A ali_reza_zareian

          I think you suggest string.format("C"). but my language is Persian and it's not for foreign language.

          D Offline
          D Offline
          Dan Mos
          wrote on last edited by
          #4

          I don't know about persian but if in UK => £9.99 in USA => $9.99. in Euro Countryies => 9.99 € in romania => 9.99 RON if it doesn't work create a custom string.format();

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups