To show placeholder characters (*) in cells used for password entry, use the SetupEditor event.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.C1FlexGrid1.Cols(0).Width = Me.C1FlexGrid1.Rows(0).HeightDisplay Me.C1FlexGrid1.ShowCursor = True Me.C1FlexGrid1.Cols(1).Caption =((Me.C1FlexGrid1.Cols(1).Name) = "Password") Me.C1FlexGrid1.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
{ this.c1FlexGrid1.Cols[0].Width = this.c1FlexGrid1.Rows[0].HeightDisplay; this.c1FlexGrid1.ShowCursor = true; this.c1FlexGrid1.Cols[1].Caption = this.c1FlexGrid1.Cols[1].Name = "Password"; this.c1FlexGrid1.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw; } |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Visual Basic Private Sub C1FlexGrid1_SetupEditor(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.RowColEventArgs) Handles C1FlexGrid1.SetupEditor Dim tb As TextBox = Me.C1FlexGrid1.Editor If Not (tb Is Nothing) Then If Me.C1FlexGrid1.Cols(e.Col).Name = "Password" Then tb.PasswordChar = "*"c Else tb.PasswordChar = CChar(0) End If End If End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
private void c1FlexGrid1_SetupEditor(object sender, C1.Win.C1FlexGrid.RowColEventArgs e) { TextBox tb = this.c1FlexGrid1.Editor as TextBox; if (tb != null) { if (this.c1FlexGrid1.Cols[e.Col].Name == "Password") tb.PasswordChar = '*'; else tb.PasswordChar = (char)0; } } |
When the user enters a password in the Password column and presses ENTER, the text is automatically converted to asterisks.