2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
We can workaround the behaviour for now by handling the GotFocus and LostFocus events of CurrencyTextBox.Though we cannot hide the zeros ,you can set it in such a way that whenever the control does not have focus,it hides zeros.However, when it gets focus it shows the zeros according to the decimal digits. C# private void currencyTextBox1_GotFocus(object sender, System.EventArgs e) { this.currencyTextBox1.CurrencyDecimalDigits = 6; }
private void currencyTextBox1_LostFocus(object sender, System.EventArgs e) { string dblval = this.currencyTextBox1.DecimalValue.ToString(); int decimalpos = this.currencyTextBox1.Text.IndexOf("."); int len = dblval.TrimEnd(''0'').Substring(decimalpos).Length; this.currencyTextBox1.CurrencyDecimalDigits = len; } VB Private Sub currencyTextBox1_GotFocus(ByVal sender As Object, ByVal e As EventArgs) Handles currencyTextBox1.GotFocus Me.currencyTextBox1.CurrencyDecimalDigits = 6 End Sub
Private Sub currencyTextBox1_LostFocus(ByVal sender As Object, ByVal e As EventArgs) Handles currencyTextBox1.LostFocus Dim dblval As String = Me.currencyTextBox1.DecimalValue.ToString() Dim decimalpos As Integer = Me.currencyTextBox1.Text.IndexOf(".") Dim len As Integer = dblval.TrimEnd("0"c).Substring(decimalpos).Length Me.currencyTextBox1.CurrencyDecimalDigits = len End Sub |
2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.