Results 1 to 2 of 2

Thread: Password Protect Files

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    11

    Question

    My problem is that I have to create a program that opens up a password screen when I access a file that I choose to be protected.

    Please can somone help. It sounds quite simple but i am quite new to VB and have tried everything.

    Later

    Mike


  2. #2
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    if you just want to protect the file in your app, try this:

    Code:
    ' in a module
    ' this can be equal to anything
    Const SECRETPASSWORD = "mydoghasfleas"
    
    'in File/Open or whatever:
    If IWantToBeProtected(FileName) = True Then
     frmPassword.show 1
     if frmPassword.txtpwd <> SECRETPASSWORD then
      MsgBox "Sorry!"
      Exit Sub
     Else
      Goto OpenFile
     End If
    End if
    OpenFile:
    ' do stuff here
    
    ' in frmPassword with two controls, txtPwd and cmdOK
    Private Sub cmdOK_Click()
     Me.Hide
    End Sub
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width