I want to change NumberDecimalSeparator of my application from "." to "/". it works when i show float numbers in my textbox. but integer types are not shown at all.
I modify thread's culture to get application-wide formatting. my code is like this:
CultureInfo ci = new CultureInfo("fa-IR", true);
ci.NumberFormat.DigitSubstitution = DigitShapes.NativeNational;
ci.NumberFormat.NumberDecimalSeparator = "/";
Thread.CurrentThread.CurrentCulture = ci;
result:
3.14 => "3/14"
100 => ""
Any help please ?
I just create such testing console application but have got a output like this:
Input next value:
3.14
3/14
Input next value:
100
100
My code was:
using System;
using System.Globalization;
using System.Threading;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
CultureInfo ci = new CultureInfo("en-US", true);
Thread.CurrentThread.CurrentCulture = ci;
Console.WriteLine("Input next value:");
string input = Console.ReadLine();
while (input != "e")
{
double dblInput = double.Parse(input);
CultureInfo ci2 = new CultureInfo("fa-IR", true);
ci2.NumberFormat.DigitSubstitution = DigitShapes.NativeNational;
ci2.NumberFormat.NumberDecimalSeparator = "/";
Thread.CurrentThread.CurrentCulture = ci2;
Console.WriteLine(dblInput);
Console.WriteLine("Input next value:");
input = Console.ReadLine();
}
}
}
}
Is here something not applicabale to your question?