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

 

  Fórum

  Visual Basic
Voltar
Autor Assunto:  criar/ler arquivo texto
®ogerVB
OSASCO
SP - BRASIL
Postada em 20/04/2005 16:06 hs            
Como que eu posso criar um arquivo texto comum, do tipo .txt, depois eu preciso ler e validar o seu conteúdo... Tudo isso em rum time.???
 
Seria mais ou menos assim:
Primeiro eu verifico seu o arquivo existe, se não existir eu o crio com um senha, se já existir eu leio e vejo se a senha está correta...
 
Obrigado
     
Martini
Pontos: 2843 Pontos: 2843
PAROBÉ
RS - BRASIL
Postada em 20/04/2005 20:35 hs         

Private Sub Command1_Click()
  CriaArq
End Sub

Private Sub CriaArq()
  If Not File_Exists("C:Teste.txt", False) Then
    Open "C:Teste.txt" For Output As #1
    Print #1, "Senha"
    Close #1
  End If
End Sub

Private Sub LerArq()
  Dim strABC As String
  If File_Exists("C:Teste.txt", False) Then
    Open "C:Teste.txt" For Input As #1
    Do While Not EOF(1)
      Line Input #1, strABC
      MsgBox "Esta é a senha " & strABC
    Loop
    Close #1
  End If
End Sub
Function File_Exists(ByVal PathName As String, Optional Directory As Boolean) As Boolean
    If PathName <> "" Then
        If IsMissing(Directory) Or Directory = False Then
            File_Exists = (Dir$(PathName) <> "")
        Else
            File_Exists = (Dir$(PathName, vbDirectory) <> "")
        End If
    End If
End Function

Private Sub Command2_Click()
  LerArq
End Sub

 
     
Página(s): 1/1    


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