namespace Test
{
public partial class NumericText : UserControl {
String text = "";

public NumericText() {
InitializeComponent();
}

private void textBox1_TextChanged(object sender, EventArgs e) {
if (IsNumeric(textBox1.Text)) text = textBox1.Text;
else textBox1.Text = text;
}