Hi
I am having difficulty getting a password form to work correctly.
I am using VB.Net.
The required functionality is to allow a change to a setting but when a save
button is clicked a password box opens requiring the password. If a correct
password is entered then the new setting/s are saved otherwise the old
settings are re-instated.
The save button calls a sub
The Sub opens the password form.
The password form checks the password and sets a global variable to true and
then hides
The Sub then saves the settings to the registry
I can't see where it is going wrong.
I would appreciate someone having a quick look at this and letting me know
if I am doing this the wrong way or if I am just making some mistake in the
code.
The code is below,
Thanks Doug
Form Declarations:
Private mPssWrdForm As FormPssWrd
Save Button code:
Call dacSaveSettings()
dacSaveSettings code:
'Display Password Form.
If mPssWrdForm Is Nothing Then
mPssWrdForm = New FormPssWrd
mPssWrdForm.ShowDialog()
Else
If mPssWrdForm.Visible = False Then
mPssWrdForm.Visible = True
End If
mPssWrdForm.Activate()
End If
'Check Password
If gfPssWrdOK Then
'Password OK
'Save Target Folder
gfPssWrdOK = False
gstTargetFolder = LabelTfrTo.Text
fSaveFailed = Not dacSetRegSettings("DestFolder", gstTargetFolder)
If fSaveFailed Then
GoTo Err_dacSaveSettings
End If
Else
LabelTfrTo.Text = gstTargetFolder
Call dacSetUpLdfreq()
CheckBoxEnable.Checked = gfEnableRun
End If
Exit_dacSaveSettings:
fFormChanged = False
Exit Sub
Err_dacSaveSettings:
MsgBox("Error Saving changes.", MsgBoxStyle.Information, _
"24x7 File Transfer Error")
GoTo Exit_dacSaveSettings
End Sub
Password Form Code:
Private Sub ButtonPsswd_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles ButtonPsswd.Click
gfPssWrdOK = LCase(TextBoxPsswd.Text) = LCase(gstPassWord)
TextBoxPsswd.Text = ""
Me.Hide()
End Sub