Full Version : Vb: Password Code
llamatronics >>Visual Basic >>Vb: Password Code


<< Prev | Next >>

Scott- 12-30-2005
if cbo1 = "PASSWORD" then
page1.hide
page2.show
end if

If cbo1 <>="PASSWORD" then
Msgbox "Please Enter a valid password"
End
End if

the cbo1 is the name of the box where you wish the password to be inserted and PASSWORD can be changed to what ever you want it to be

LlamaTronics- 12-30-2005
Just a note - this is not a very secure password protection code - but the idea works!

Also, it would be 1 password only, not multiple users with individual passwords.

If you are just looking to password protect the program, and don't need tight tight security, this should do it!

Thanks for the code scott!

Scott- 12-30-2005
i can get you a more complex code in the next week or two wen i get back to my college pc, thats just the general outline, but all it requires is more IFS

LlamaTronics- 12-30-2005
well, yes and no... for basic stuff, yes, that code works great! Just don't trust your bank account information behind it!

More secure passwords should be encrypted. I'm not saying its a bad code, I just didn't want anyone who didn't know to come and use that, thinking that it is the worlds best security! Thats all smile.gif

Scott- 12-31-2005
oh its now way the worlds best security, but will survice if you simply want to hide documents behind a password for example. If you wish to have world class security i suggest you use a safe:P or buy a professional program.

Scott- 01-03-2006
as promist, here is the code for the VB password. This is a basic code that will not allow entry to the documents/pages behind it, however i will update it further to include non imputs at a later date, probably tommorrow if i remember.

Private Sub cmd1_Click()
If input1 = "123" Then
MsgBox ("Password Accepted")
Page1.Hide
page2.Show
Else
If input1 <> "123" Then
MsgBox ("Access Denied")
End
End If
End If
End Sub


LlamaTronics- 01-03-2006
Just a couple suggestions... Try putting your code within
CODE
tags

Also, if you can, try to align the code correctly, for easier viewing.. Example:

[code]

if condition = true then
   do action
else
   do other action
end if



Also, what version of VB are you using? definately doesn't look like VB.Net code...

Scott- 01-03-2006
i know, i had to restart and just posted what i had saving me from losing it all. iam working on it and its vb6

Llama_in_the_herd- 01-06-2006
Maybe, I haven't -*test*-('")ed this but it might work.

cls
input "What is the password?" yourguess$
if yourguess$ = 2499 [any array can go here]
if yourguess$ = < 2499 end
if yourguess$ = > 2499 end

So its like a guessing password but not as good as yours.

Scott- 01-07-2006
its needs to be structured or it will crash.

LlamaTronics- 01-07-2006
QUOTE
cls
input "What is the password?" yourguess$
if yourguess$ = 2499 [any array can go here]
if yourguess$ = < 2499 end
if yourguess$ = > 2499 end


-- that doesn't look like VB at all....

Llama_in_the_herd- 06-23-2006
I know. llamatronics/blush.gif I am just a learner.

Free Forum Hosting by Forumer.comTM!