Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

wpf numeric only textbox

<TextBox Name="NumberTextBox" PreviewTextInput="NumberValidationTextBox"/>

-------------------------------------------------------------------------------

using System.Text.RegularExpressions;
private void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
{
    Regex regex = new Regex("[^0-9]+");
    e.Handled = regex.IsMatch(e.Text);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# center text 
Csharp :: unity to integer 
Csharp :: get self component in unity 
Csharp :: change height of rect transform unity 
Csharp :: degree to radians c# 
Csharp :: how to set a custom size for window in monogame 
Csharp :: Type is not marked as serializable. 
Csharp :: unity quit code 
Csharp :: Program for factorial of a number in c# 
Csharp :: clone gameobject unity c# 
Csharp :: c# loop datatable rows 
Csharp :: check last character of a string c# 
Csharp :: unity wait for seconds 
Csharp :: c# int to bool 
Csharp :: csharp string to double 
Csharp :: setactive unity 
Csharp :: how to get rigidbody speed in unity 
Csharp :: check if number is even or odd c# 
Csharp :: how to destroy in unity 
Csharp :: stop process c# 
Csharp :: c# empty char 
Csharp :: c# convert string to char array 
Csharp :: taking input in single line c# 
Csharp :: c# declare empty string array 
Csharp :: dynamics 365 update record c# 
Csharp :: how to store more precise data then double c# 
Csharp :: unity3d quaternion add 90 degrees 
Csharp :: Warum wächst Weizen besonders gut in den Steppen? 
Csharp :: Attach Mixer to Audio Source via script 
Csharp :: c# cmd 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =