E
Earl
I'm adding password encryption to the Employees form. I have a
strongly-typed dataset being used as the datasource for the
EmployeesBindingSource, and the Employees table set as the datamember. All
controls on the form are bound to the EmployeesBindingSource. Except for the
password ...
I set up separate handlers for the Password and bind this control manually
when I New() the form:
Private Sub BindPasswordControl()
Dim b As Binding = New Binding("Text", EmployeesBindingSource,
"Password")
AddHandler b.Format, AddressOf PasswordFormat
AddHandler b.Parse, AddressOf PasswordParse
txtPassword.DataBindings.Add(b)
End Sub
Private Sub PasswordFormat(ByVal sender As Object, ByVal e As
ConvertEventArgs)
If IsDBNull(e.Value) = False Then
e.Value = EncryptPassword(CStr(e.Value))
End If
End Sub
The handlers ARE being called, however, the Password column of the
strongly-typed dataset does not get changed to the password entered into the
Password textbox (it remains null). I can also see that the e.Value is being
passed to the EncryptPassword function. Yet when I check the datatable, the
Password column is empty (all other columns have the correct data). What the
heck am I overlooking here!?
strongly-typed dataset being used as the datasource for the
EmployeesBindingSource, and the Employees table set as the datamember. All
controls on the form are bound to the EmployeesBindingSource. Except for the
password ...
I set up separate handlers for the Password and bind this control manually
when I New() the form:
Private Sub BindPasswordControl()
Dim b As Binding = New Binding("Text", EmployeesBindingSource,
"Password")
AddHandler b.Format, AddressOf PasswordFormat
AddHandler b.Parse, AddressOf PasswordParse
txtPassword.DataBindings.Add(b)
End Sub
Private Sub PasswordFormat(ByVal sender As Object, ByVal e As
ConvertEventArgs)
If IsDBNull(e.Value) = False Then
e.Value = EncryptPassword(CStr(e.Value))
End If
End Sub
The handlers ARE being called, however, the Password column of the
strongly-typed dataset does not get changed to the password entered into the
Password textbox (it remains null). I can also see that the e.Value is being
passed to the EncryptPassword function. Yet when I check the datatable, the
Password column is empty (all other columns have the correct data). What the
heck am I overlooking here!?