Hi Guys,

I have a password column in my datagridview, and I'd like to display the characters as a * while editing and even displaying. I have the following code but when saving to the database the password gets saved as ***** for example.:

Code:
Private Sub dgvUsers_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles dgvUsers.CellFormatting
        If dgvUsers.Columns(e.ColumnIndex).Name.Equals("Password") Then

            If (Not e.Value Is Nothing) Then
                e.Value = New String(CChar("*"), e.Value.ToString.Length)

            End If

        End If
    End Sub
Code:
Private Sub dgvUsers_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles dgvUsers.EditingControlShowing

        If (CType(sender, DataGridView).CurrentCell.ColumnIndex <> 4) Then

            If (CType(sender, DataGridView).CurrentCell.ColumnIndex = 3) Then

                CType(e.Control, TextBox).PasswordChar = CChar("*")

            Else

                CType(e.Control, TextBox).PasswordChar = Char.MinValue

            End If

        End If
    End Sub
Please advise on the best way to accomplish this