Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9183011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:41:52+00:00 2026-06-17T18:41:52+00:00

I have to detect decimal separator in current windows setting. Im using visual studio

  • 0

I have to detect decimal separator in current windows setting. Im using visual studio 2010, windows form. In particular, if DecimalSeparator is comma, if user input dot in textbox1, I need show zero in textbox2.

I tryed with this code, but not works:

private void tbxDaConvertire_KeyPress(object sender, KeyPressEventArgs e)
    {
        string uiSep = CultureInfo.CurrentUICulture.NumberFormat.NumberDecimalSeparator;
        if (uiSep.Equals(","))
        {
            while (e.KeyChar == (char)46)
            {
                tbxConvertito.Text = "0";
            }
        } 
    }

I have tryed also this code, but not work:

private void tbxDaConvertire_KeyPress(object sender, KeyPressEventArgs e)
    {
        string uiSep = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
        if (uiSep.Equals(","))
        {
            if (e.KeyChar == (char)46)
            {
                tbxConvertito.Text = "0";
            }
        } 
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:41:54+00:00Added an answer on June 17, 2026 at 6:41 pm

    Solution:

    private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
    {
        char a = Convert.ToChar(Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);
        if (e.KeyChar == a)
        {
            e.Handled = true;
            textBox1.Text = "0";
        }
    }
    

    That way, when you hit . or , you will have a 0 in your TextBox.

    EDIT:

    If you want to insert a 0 everytime you hit the decimal separator, this is the code:

    char a = Convert.ToChar(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator);
    if (e.KeyChar == a)
    {
        e.KeyChar = '0';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to detect avtivityLevel of microphone in Flex. I am using the activityLevel
I am writing a Windows C++ app which I would like to have detect
Using PHP, I have to detect ' (single quotation mark followed by double quotation
I have to detect the pattern of 6 circles using opencv. I have detected
I have a requirement where I have to detect if the user is not
I have a situation where I have to detect when an application window is
I have a WebPage on which I have to detect and prevent usage of
I'm working on an app in which i have to detect left eye, right
I have a UIWebView with detect phone numbers unchecked. However, it keeps underlining the
I have wrote a script to detect when I reach the div element which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.