How can I return the key?, mean if I want to allow only integer values in the textbox, how can I don\'t allow user to not enter non-integers, regarding, KeyPress
You can inherit from TextBox and then:
Protected Overrides Sub OnTextInput(ByVal e As System.Windows.Input.TextCompositionEventArgs)
Dim newChar As Char = Convert.ToChar(e.Text)
If Not [Char].IsDigit(newChar) Then e.Handled = True
End Sub
C# version
protected override void OnTextInput(System.Windows.Input.TextCompositionEventArgs e)
{
char newChar = Convert.ToChar(e.Text);
if (!Char.IsDigit(newChar)) e.Handled = true;
}