private void TextBox_TextChanged(object sender, EventArgs e)
{
string value = TextBox.Text.Replace(",", "");
long ul;
if (long.TryParse(value, out ul))
{
TextBox.TextChanged -= TextBoxTextChanged;
TextBox.Text = string.Format("{0:#,#0}", ul);
TextBox.SelectionStart = TextBox.Text.Length;
TextBox.TextChanged += TextBoxTextChanged;
}
}
I used above code for making Calculator. I want to get result by
pressing equal comma with decimal value. Normally I can type
1,234.1234 in the textBox but if I press 1,000.123 + 1,000.123
it does not give the result 2,000.246 - it gives result only
2000.246. I mean comma with decimal value not getting by
pressing equal.
Can anybody kindly please help me to solve this problem ?
What I have tried:
I used above code for making Calculator. I want to get result by
pressing equal comma with decimal value. Normally I can type
1,234.1234 in the textBox but if I press 1,000.123 + 1,000.123
it does not give the result 2,000.246 - it gives result only
2000.246. I mean comma with decimal value not getting by
pressing equal.
Can anybody kindly please help me to solve this problem ?