Multiple Passwords

  • Thread starter Thread starter Joshua Kendall
  • Start date Start date
J

Joshua Kendall

This is the code that I currently Have for one password
how do I specify multiple ones? There is no "or"
statement! What do I do?

Private Sub LoginBTN_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles LoginBTN.Click
If PassINP.Text = "bluecats" And UserINP.Text
= "Joshua" Then Dim frmMainApp As New frmMainApp() :
frmMainApp.Show() Else End
End Sub
End Class
 
This is the code that I currently Have for one password
how do I specify multiple ones? There is no "or"
statement! What do I do?

Private Sub LoginBTN_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles LoginBTN.Click
If PassINP.Text = "bluecats" And UserINP.Text
= "Joshua" Then Dim frmMainApp As New frmMainApp() :
frmMainApp.Show() Else End
End Sub
End Class

What do you mean there is no "Or"? sure there is.
You can write:
If txt.text = "x" or txt.text="y" then
'do something
end if

you can also use a "case" for this sort of thing:
select case txt.Text

case "a","b","c"
'do something

case else
msgbox "bad password"
end select

note, however, that it is considered bad form to hard code passwords inside
your code. It is better to save to in a database or at least the config
file of your application so they can later be changed and maintained
without having to recompile your code.
another bad thing that can happen: your code can be "decompiled" using a
tool like "Refelctor" or "Anakrino" and the passwords can be taken from it
easily.
That's why it's usually better to save the passwords in an encrypted state
somewhere as well.
 
Thank you the "or" statement was in the wrong place,
that's why it wasn't showing up valid. How could I access
passwords if I saved them in a dbase III file? and how
could I encode them?

Thanks for the help!

Joshua Kendall
 
Joshua Kendall said:
This is the code that I currently Have for one password
how do I specify multiple ones? There is no "or"
statement! What do I do?

Joshua... what are doing? You are posting messages under various accounts
and you start new threads all the time.

I tried to explain it earlier and you are doing the same thing now. The
"write a line of code" post a question methodology. My suggestion is to
stop and think. Design something that makes sense rather than coding
whatever strikes you this minute. A couple of messages ago it was a timer
issue on a dialog box, now it is how to hardcode a bunch of account/password
pairs and in another thread you have the "splash screen won't go away"
problem.

You are designing an unmaintainable mess and that can't be your purpose.
How can you even ask about how to access data from a dBASE file if you can't
turn the timer off or make the splash screen disappear? You aren't 100
lines of code away from finishing this, you are conceptually _eons_ away.
You have your spaceship launched and you are radioing back to Earth, "which
way is Mars?"

Consider pseudocode. Know what you are trying to program before you spend
your time (and ours) trying to code something that won't work should you be
lucky enough to remove all the bugs. Contrary to popular belief software
development isn't a matter of overcoming bugs... it's an engineering task.
Try (I'm trying to be helpful) reading the code you just posted... you
created a variable frmMainApp in the event handler. Where do you think that
variable will go when the event handler ends?

I think we are all wondering is it a password application you're writing
because so far you don't have that. Finish the application first and add a
password layer around it. No architect I know of designs the stairs to the
building "before" they have designed the building itself.

Finish frmMainApp()... have it operate without any worry about whether some
stranger has gained access (they won't have if you don't finish the app.)
Then when it is all finished post a single question (if a Google search
doesn't answer it) similar to "how do I add account/password verification to
my app?"

I may sound rude but I'm saving you 40 hours of posting questions. Nobody
wants to explain how to hide your splash screen when it starts the app
because nobody would do it that way. At least not "twice" :-)

"Slow down" I don't know how many times I have suggested programmers
"program" by simply taking their fingers off the keyboard.

Tom
 
Hi Tom,

I am looking to it and see everytime another come in. Good that you wrote
this, but this I found specialy good.
Finish frmMainApp()... have it operate without any worry about whether some
stranger has gained access (they won't have if you don't finish the app.)

ROFL but with sence

Cor
 
Back
Top