Quello postato da StegcO è codice VB6.

Prova in questo modo:

codice:
    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        Dim bInvalid As Boolean
        If IsNumeric(e.KeyChar) Then
            bInvalid = False
        Else
            Select Case Asc(e.KeyChar)
                Case 46
                    If TextBox1.Text.IndexOf(e.KeyChar) >= 0 Then
                        bInvalid = True
                    End If
                Case 8
                    bInvalid = False
                Case Else
                    bInvalid = True
            End Select
        End If
        e.Handled = bInvalid
    End Sub
Ho fatto in modo che possa accettare solo caratteri numerici e il punto (una sola volta).
Funziona anche il BackSpace, ma tutti gli altri caratteri sono esclusi.

Se hai bisogno della virgola anzichè del punto, basta cambiare il corrispondente codice Ascii nella Select Case

Boolean