473,394 Members | 1,797 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Password selection

nkp
I wish to enable more than one named user to access password protected
menu ie: Tom,Dick and Harry rather than JUST Tom.
Can I do this with Case Select...doesn't seem work for me.
Assistance much appreciated.
Private Sub cmdOk_Click()
Dim blnEnter As Boolean
Static intCount As Integer
blnEnter = False
intCount = intCount + 1
lblAttempt.Caption = intCount

Select Case txtUsername
Case "Tom"

If txtPassword = "nkp12345" Then
blnEnter = True
End If
End Select

If blnEnter = True Then
Unload Me
frmMenu.Show
Else
If intCount >= 3 Then
MsgBox "you have exceeded your 3 attempts"
Unload Me
End If
End If
End Sub

Jul 17 '05 #1
2 1918
If the question is how to hard-code multiple names, just add additional Case
statements:

Select Case txtUsername.Text
Case "Tom"

If txtPassword.Text = "nkp12345" Then
blnEnter = True
End If

Case "Dick"

If txtPassword.Text = "abc99009" Then
blnEnter = True
End If

Case "Harry"

If txtPassword.Text = "qwe66766" Then
blnEnter = True
End If

Case Else:
End Select
If you're asking how to avoid hard coding the usernames and passwords so any
Tom, Dick or Harry can use the system, you'll have to resort to saving the
valid usernames and passwords in a text file or the registry, and based on
the username entered, load the pw to check and go from there.

--

Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.
"nkp" <we***********@btinternet.com> wrote in message
news:bo**********@sparta.btinternet.com...
: I wish to enable more than one named user to access password protected
: menu ie: Tom,Dick and Harry rather than JUST Tom.
: Can I do this with Case Select...doesn't seem work for me.
: Assistance much appreciated.
:
:
: Private Sub cmdOk_Click()
: Dim blnEnter As Boolean
: Static intCount As Integer
: blnEnter = False
: intCount = intCount + 1
: lblAttempt.Caption = intCount
:
: Select Case txtUsername
: Case "Tom"
:
: If txtPassword = "nkp12345" Then
: blnEnter = True
: End If
: End Select
:
: If blnEnter = True Then
: Unload Me
: frmMenu.Show
: Else
: If intCount >= 3 Then
: MsgBox "you have exceeded your 3 attempts"
: Unload Me
: End If
: End If
: End Sub
:
Jul 17 '05 #2
nkp
Thanks Randy...

Randy Birch wrote:
If the question is how to hard-code multiple names, just add additional Case
statements:

Select Case txtUsername.Text
Case "Tom"

If txtPassword.Text = "nkp12345" Then
blnEnter = True
End If

Case "Dick"

If txtPassword.Text = "abc99009" Then
blnEnter = True
End If

Case "Harry"

If txtPassword.Text = "qwe66766" Then
blnEnter = True
End If

Case Else:
End Select
If you're asking how to avoid hard coding the usernames and passwords so any
Tom, Dick or Harry can use the system, you'll have to resort to saving the
valid usernames and passwords in a text file or the registry, and based on
the username entered, load the pw to check and go from there.


Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: lawrence | last post by:
Is this the correct way to test for a method before I use it? createRange() is, I believe, an IE only method. function wrapSelectionInTag(selection, tag) { if (document.selection.createRange)...
4
by: Jean | last post by:
Hi everyone, I was hoping somebody could assist me in this issue. I am quite a newbie to ODBC connections and was struggling to search for related topics. Here is my situation: I have a...
5
by: STeve | last post by:
Hey guys, I currently have a 100 page word document filled with various "articles". These articles are delimited by the Style of the text (IE. Heading 1 for the various titles) These articles...
1
by: eighthman11 | last post by:
Hi everyone: I created a custom toolbar called Password, so users can change their password. I used the Command "User and Group Accounts". I know the user can not change anything in the Tab...
2
by: vivsonavane | last post by:
hi all i am making a web page which has a username to register but i dont want to put any password for completing registration. the idea is when user makes any decision and select ok one dialog...
1
by: pipestew | last post by:
tbl_Report - DBReportName - MenuReportName - FacilityID - ReportType - Viewable (Yes/No) - PasswordProtected (Yes/No) - Password (Encrypted) On MenuReport form...
2
by: vanditnagar | last post by:
Hi, I am facing the difficulty in the selecting a text on the browser . And highlighting the text. I am using the window.getSelection() to get the object and after...
3
by: Venturini | last post by:
I am trying to put together a web page where the customer makes choices of products and is then given a total. I am extremely new to Javascript and have managed to get as far as I have from web...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.