Private Sub TextBox1_Change()
OnlyNumbers
End Sub
Private Sub OnlyNumbers()
If TypeName(Me.ActiveControl) = "TextBox" Then
With Me.ActiveControl
If Not IsNumeric(.Value) And .Value <> vbNullString Then
.Value = vbNullString
End If
End With
End If
End Sub
설명 : 해당컨트롤이 텍스트박스이고, 숫자가 아닌경우는 빈값(vbNullstring)으로 초기화 시켜준다.
댓글 없음:
댓글 쓰기