Code the
keypress
event of the textboxes. Allow numbers, the backspace key,
and the decimal point. Only write the code once and use Handles.

Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress

    If e.KeyChar = ControlChars.Back Then
        MessageBox.Show("error")
        e.Handled = True
    End If

End Sub

you can leverage some of the methods in the Char class for this:

    If Char.IsNumber(e.KeyChar) OrElse e.KeyChar = Chr(Keys.Back) OrElse e.KeyChar = "."c Then

    End If

hmmm when I type a number on the textbxo1 i cant :(

This is a duplicate of the same question in VB.NET. You should not create threads in multiple forums for the same question because it just confuses everyone.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.