USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Fórum

  Visual Basic
Voltar
Autor Assunto:  Problema com data
IceEyes
BRASIL
MS - BRASIL
ENUNCIADA !
Postada em 16/01/2008 17:01 hs            
alguem me ajuda aew
 
format(text1,"0#/0#0#") para q minha data fique 01/01/08 só que tenho q digitar 010108 mas se eu der um enter muda para 05/98/45 haiuhauiaa HELP!
   
KoRn
Pontos: 2843
SAO PAULO
SP - BRASIL
Postada em 16/01/2008 17:04 hs            
voce tem um txt onde vc quer digitar uma data e ela formate automaticamente ?
 
Private Sub txtfundacao_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case vbKeyDelete, vbKeyBack
Case 48 To 57
            If Len(txtfundacao.Text) = 2 Or Len(txtfundacao.Text) = 5 Then
                 txtfundacao.Text = txtfundacao.Text & "/"
            End If
             txtfundacao.SelStart = Len(txtfundacao.Text)
        Case 8, 44
        Case Else
            KeyAscii = 0
    End Select
End Sub
     
IceEyes
BRASIL
MS - BRASIL
ENUNCIADA !
Postada em 16/01/2008 17:18 hs            
Isso mesmo tenho um text e quero q formate como data
   
KoRn
Pontos: 2843
SAO PAULO
SP - BRASIL
ENUNCIADA !
Postada em 16/01/2008 17:20 hs            
funcionou ?
 
essa formata CPF
 
Private Sub txtcpf_Change()
If Len(txtcpf) = 3 Then
         txtcpf = txtcpf & "."
         txtcpf.SelStart = 5
      End If
      If Len(txtcpf) = 7 Then
         txtcpf = txtcpf & "."
         txtcpf.SelStart = 9
      End If
      If Len(txtcpf) = 11 Then
         txtcpf = txtcpf & "-"
         txtcpf.SelStart = 13
      End If
End Sub
 
 
essa telefone
 
 
Private Sub txttelefores_Change()
' formatacao de telefone
If Not Len(txttelefores.Tag) = 0 Then Exit Sub
         txttelefores.Tag = txttelefores.SelStart
         txttelefores.Text = Replace(txttelefores.Text, "-", "")
    If Len(txttelefores.Text) > 3 Then
         txttelefores = Format(val(txttelefores.Text), "## ####-####")
         txttelefores.SelStart = txttelefores.Tag + 1
    Else
         txttelefores.SelStart = txttelefores.Tag + 1
    End If
         txttelefores.Tag = ""
End Sub
 
 
Essa CNPJ
 
 
Private Sub txtcnpj_Change()
If Len(txtcnpj) = 2 Then
         txtcnpj = txtcnpj & "."
         txtcnpj.SelStart = 4
      End If
      If Len(txtcnpj) = 6 Then
         txtcnpj = txtcnpj & "."
         txtcnpj.SelStart = 8
      End If
      If Len(txtcnpj) = 10 Then
         txtcnpj = txtcnpj & "/"
         txtcnpj.SelStart = 12
      End If
      If Len(txtcnpj) = 15 Then
         txtcnpj = txtcnpj & "-"
         txtcnpj.SelStart = 17
      End If
End Sub
TÓPICO EDITADO
 
Treze
Pontos: 2843 Pontos: 2843
SÃO VICENTE
SP - BRASIL
ENUNCIADA !
Postada em 17/01/2008 11:51 hs            
' depois de muitas dicas que estudei cheguei a esta conclusão
' o código a seguir além de formatar corretamente a data ele
' ainda permite que você digite apenas NUMEROS, e deixa a
' tecla Backspace funcionando normalmente

' Primeiro coloque em um módulo o seguinte código:

Function CampoDATA(obj As Object, Keyasc As Integer)
If Not ((Keyasc >= Asc("0") And Keyasc <= Asc("9")) Or Keyasc = 8) Then
Keyasc = 0
Exit Function
End If
If Keyasc <> 8 Then
If Len(obj.Text) = 2 Or Len(obj.Text) = 5 Then
obj.Text = obj.Text + "/"
obj.SelStart = Len(obj.Text)
End If
End If
End Function


' Para chamar afunção basta você colocar o seguinte código
' no evento KeyPress do seu campo como mostrado abaixo:

Private Sub txtData_KeyPress(KeyAscii As Integer)
'
CampoDATA txtadmissao, KeyAscii
'
End Sub

 
bom o melhor deste código é que você põe ele em um módulo e pode usar em qualquer campo de sua aplicação chamando apenas com alinha acima
 
até
   
KoRn
Pontos: 2843
SAO PAULO
SP - BRASIL
ENUNCIADA !
Postada em 17/01/2008 11:54 hs            
Aew TREZE , poe essa na sessao de dicas , essa foi boa, valew amigo, se tiver mais dessas posta aqui irmao Emoções
   
Página(s): 1/2      PRÓXIMA »


Seu Nome:

Seu eMail:

ALTERAR PARA MODO HTML
Mensagem:

[:)] = 
[:P] = 
[:(] = 
[;)] = 

HTML DESLIGADO

     
 VOLTAR

  



CyberWEB Network Ltda.    © Copyright 2000-2025   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página