by
226 11
0
6
2,726
1
Top 1% !
Popular
Famous
Tagged
Specified
OpenSource
Popularity: 5800th place
Created
Modified Aug 7, 2014

Published on:

Languagecsharp
LicenseMIT_X11

textbox for doubles

Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/117137/textbox-for-doubles?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
//handler for the keyPress event on a textbox to only allow writing doubles private void tbDouble_KeyPress(object sender, KeyPressEventArgs e) { if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.') { e.Handled = true; } // only allow one decimal point if (e.KeyChar == '.' && (sender as TextBox).Text.IndexOf('.') > -1) { e.Handled = true; } }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus