Oppure tramite le api di win:
basta che chiami la sub per ogni textbox che vuoi limitare all'inserimento esclusivamente numerico cosi':codice:Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _ (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _ (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Sub SetNumeric(TextBox As TextBox, Optional Force As Boolean) Dim style As Long Const GWL_STYLE = (-16) Const ES_NUMBER = &H2000 style = GetWindowLong(TextBox.hWnd, GWL_STYLE) If Force Then style = style Or ES_NUMBER Else style = style And Not ES_NUMBER End If SetWindowLong TextBox.hWnd, GWL_STYLE, style End Sub
..e sei a posto.codice:call SetNumeric(nometextbox1,true) call SetNumeric(nometextbox2,true) ...
Per gli array di controlli, devi passare ciascun elemento dell'array, non puoi passare tutto l'array (mi pare)

Rispondi quotando