Password form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Doug Bell

    #1

    Password form

    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.Sho wDialog()

    Else

    If mPssWrdForm.Vis ible = False Then

    mPssWrdForm.Vis ible = True

    End If

    mPssWrdForm.Act ivate()

    End If

    'Check Password

    If gfPssWrdOK Then

    'Password OK

    'Save Target Folder

    gfPssWrdOK = False

    gstTargetFolder = LabelTfrTo.Text

    fSaveFailed = Not dacSetRegSettin gs("DestFolder" , gstTargetFolder )

    If fSaveFailed Then

    GoTo Err_dacSaveSett ings

    End If

    Else

    LabelTfrTo.Text = gstTargetFolder

    Call dacSetUpLdfreq( )

    CheckBoxEnable. Checked = gfEnableRun

    End If

    Exit_dacSaveSet tings:

    fFormChanged = False

    Exit Sub

    Err_dacSaveSett ings:

    MsgBox("Error Saving changes.", MsgBoxStyle.Inf ormation, _

    "24x7 File Transfer Error")

    GoTo Exit_dacSaveSet tings

    End Sub

    Password Form Code:
    Private Sub ButtonPsswd_Cli ck(ByVal sender As System.Object, _

    ByVal e As System.EventArg s) _

    Handles ButtonPsswd.Cli ck

    gfPssWrdOK = LCase(TextBoxPs swd.Text) = LCase(gstPassWo rd)

    TextBoxPsswd.Te xt = ""

    Me.Hide()

    End Sub




Working...