public static void CurrencyFormat(TextBoxX text) { if (!string.IsNullOrEmpty(text.Text)) { var culture = new CultureInfo("en-US"); text.Text = text.Text.Replace(".0000", "").Replace(".00", "").Replace(".0", ""); var valueBefore = double.Parse(text.Text, NumberStyles.AllowThousands); text.Text = string.Format(culture, "{0:N0}", valueBefore); text.Select(text.Text.Length, 0); } }