Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can create a custom cell and column, and use a textbox with the password mask as your edit control. </p> <p>To get around returning the clear text when you leave edit mode, you can store the actual password value in a seperate property of the cell, and in the GetFormattedValue event (i believe) you can return a string made up of entirely "*" characters to mask the regular display.</p> <pre><code>Protected Overrides Function GetFormattedValue(ByVal value As Object, ByVal rowIndex As Integer, ByRef cellStyle As System.Windows.Forms.DataGridViewCellStyle, ByVal valueTypeConverter As System.ComponentModel.TypeConverter, ByVal formattedValueTypeConverter As System.ComponentModel.TypeConverter, ByVal context As System.Windows.Forms.DataGridViewDataErrorContexts) As Object Dim strVal As String strVal = New String(CChar("*"), value.ToString.Length) Return MyBase.GetFormattedValue(strVal, rowIndex, cellStyle, valueTypeConverter, formattedValueTypeConverter, context) End Function Public Overrides Sub InitializeEditingControl(ByVal rowIndex As Integer, _ ByVal initialFormattedValue As Object, ByVal dataGridViewCellStyle As DataGridViewCellStyle) MyBase.InitializeEditingControl(rowIndex, initialFormattedValue, _ dataGridViewCellStyle) Dim ctl As PasswordTextBoxEditingControl = _ CType(DataGridView.EditingControl, PasswordTextBoxEditingControl) If IsDBNull(Me.Value) Then ctl.Text = "" Else ctl.Text = CType(Me.Value, String) ctl.PasswordChar = "*" ctl.Mask = "*" End If End Sub </code></pre> <p>for more information on what you are trying to do, visit this: <a href="http://www.vbforums.com/showthread.php?t=554744" rel="nofollow noreferrer">http://www.vbforums.com/showthread.php?t=554744</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload