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 82867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:41:03+00:00 2026-05-10T21:41:03+00:00

I am doing an Financial Winforms application and am having some trouble with the

  • 0

I am doing an Financial Winforms application and am having some trouble with the controls.

My customer needs to insert decimal values all over the place (Prices, Discounts etc) and I’d like to avoid some of the repeating validation.

So I immediately tried the MaskedTextBox that would fit my needs (with a Mask like ‘€ 00000.00’), if it weren’t for the focus and the length of the mask.

I can’t predict how big the numbers are my customer is going to enter into the app.

I also can’t expect him to start everything with 00 to get to the comma. Everything should be keyboard-friendly.

Am I missing something or is there simply no way (beyond writing a custom control) to achieve this with the standard Windows Forms controls?

  • 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. 2026-05-10T21:41:04+00:00Added an answer on May 10, 2026 at 9:41 pm

    This two overriden methods did it for me (disclaimer: this code is not in production yet. You may need to modify)

        protected override void OnKeyPress(KeyPressEventArgs e)     {         if (!char.IsNumber(e.KeyChar) & (Keys)e.KeyChar != Keys.Back              & e.KeyChar != '.')         {             e.Handled = true;         }          base.OnKeyPress(e);     }      private string currentText;      protected override void OnTextChanged(EventArgs e)     {         if (this.Text.Length > 0)         {             float result;             bool isNumeric = float.TryParse(this.Text, out result);              if (isNumeric)             {                 currentText = this.Text;             }             else             {                 this.Text = currentText;                 this.Select(this.Text.Length, 0);             }         }         base.OnTextChanged(e);     } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Doing a code review I've stumbled over GWM in Java-Spring-GWT web-application. As this product
I am doing a financial application in which I am expecting a data concurrency
So, I am debugging a pretty complex financial reporting application, where almost all of
I want to use Decimal class in my Python program for doing financial calculations.
Doing my first SL4 MVVM RIA based application and i ran into the following
Doing some jquery animation. I have certain divs set up with an attribute of
Doing some homework here (second assignment, still extremely green...). The object is to read
I'm trying to write a quick (ha!) program to organise some of my financial
doing some quick web dev work for a local body modification parlour just in
I've recently begun to use R for doing calculations with financial data, so please

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.