Easiest Way?

  • Thread starter Thread starter Newbie!
  • Start date Start date
N

Newbie!

Hey Group, Whats the Easiest way to Password protect a form?

I mean so that when i click on a command button to load another for it will
ask me for the Password? This password will be the same and never change.

Any Code of References

Thanks for any help
Si
 
This should be the easiest way:

Private Sub Button1_Click_1(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click

If InputBox("Password", "Password") = "MySecretPassWord" Then
Dim f As New Form1
f.Show()
Else
MessageBox.Show("Wrong password")
End If
End Sub

BUT BE AWARE, there are a lot of disadvantages:
- you have to hard-code your password
- using decompilation of your assemblie your pw could be retrieved

So basically, this is a quick-and-dirty solution that provides very limited
password protection...

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top