Jump to content

Auto formatação de Nomes


Recommended Posts

1. Abrir 1 formulário.

2. Adicionar uma TextBox.

Codigo :

Private Sub Text1_Change()
    Text1.Text = Replace(Text1.Text, " E", " e", , , vbTextCompare)
    Text1.Text = Replace(Text1.Text, "De", "de", , , vbTextCompare)
    Text1.Text = Replace(Text1.Text, "Do", "do", , , vbTextCompare)
    Text1.Text = Replace(Text1.Text, "Dos", "dos", , , vbTextCompare)
    Text1.SelStart = Len(Text1.Text) + 1
    Text1.SelLength = Len(Text1.Text)
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
    Dim vPos As Long
    vPos = Text1.SelStart
    If KeyAscii >= 97 And KeyAscii <= 122 Then
        If vPos = 0 Then
            KeyAscii = KeyAscii - 32
        ElseIf Mid(Text1.Text, vPos, 1) = " " Then
            KeyAscii = KeyAscii - 32
        End If
    End If
End Sub

Ao escreverem na caixa de texto a mesma irá formatar o nome automáticamente.

Até+ :bye2:



Que minha coragem seja maior que meu medo e que minha força seja tão grande quanto minha fé.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.