VIRGULA

USUARIO.EXCLUIDOS 06/01/2005 19:50:37
#59084
Gostaria de solicitar uma orientação...
O seguinte.:
Se o primeiro caractere digitado for uma vírgula "," então não aceitar, mais se for digitado depois de um numero qualquer aceitar.

Grato pela atenção........
USUARIO.EXCLUIDOS 06/01/2005 20:10:49
#59089
Assim deve dar:

Dim variavel As Boolean
variavel = Text1.Text Like ",*"
If variavel = True Then
MsgBox "Tem virgula!!!!!!!!!!!!!!!"
Else
MsgBox "Não tem virgula"
End If
MAICONCARDOSO 06/01/2005 20:25:32
#59092
Ou assim:

  
Function OnlyNumber(ControleSel As Control)
On Error GoTo err_OnlyNumber
If ControleSel = "-" Then Exit Function 'Para aceitar numeros negativos
If IsNumeric(ControleSel) = False Then
ControleSel = 0
Seltext ControleSel
End If
err_OnlyNumber:
Select Case Err.Number
Case Is = 0
Case Else
MsgBox "erro!!"
End Select
End Function



Depois voce coloca no evento Change do textbox:

OnlyNumber Text1 'Text1 = Nome do seu textbox

Abraço,
MAICONCARDOSO 06/01/2005 20:27:21
#59093
Esqueci:

O Seltext é outra Function:

   
Function Seltext(ControleSel As Control)
ControleSel.SelStart = 0
ControleSel.SelLength = Len(ControleSel)
End Function


Agora sim!!
USUARIO.EXCLUIDOS 06/01/2005 23:11:23
#59104
Muito obrigado pela ajuda de vcs....

Coloquei o codigo do Maicon Cardoso e BINGO.....Deu certo...

Valeu pela força.
Tópico encerrado , respostas não são mais permitidas