سلام به همه
دوستان من دو تا Text Box روی فرمم دارم که در رویداد TextChanged اونها کد زیر رو قرار دادم
decimal numb;
if (decimal.TryParse(textBox1.Text, out numb))
{
textBox1.Text = string.Format("{0:N0}", numb);
textBox1.SelectionStart = textBox1.Text.Length;
}
تا اعدد سه رقم سه رقم از هم جدا بشن
اما متاسفانه نمیشه این ها رو با هم جمع کرد و برنامه خطا میده...
ضمن اینکه از کد زیر هم استفاده کردم
if (textBox2.Text == "" || textBox1.Text == "0") return;
decimal price;
price = decimal.Parse(textBox2.Text, System.Globalization.NumberStyles.Currency);
textBox2.Text = price.ToString("#,#");
textBox2.SelectionStart = textBox2.Text.Length;