By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,168 Members | 2,599 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,168 IT Pros & Developers. It's quick & easy.

Easiest Way?

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
"Newbie!" <s_************@yahoo.co.uk> wrote in message
news:h-********************@karoo.co.uk...
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

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.