To hide the characters that have already been entered and do not need edited, use the OwnerDrawCell event.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub C1FlexGrid1_OwnerDrawCell(ByVal sender As Object, ByVal e As C1.Win.C1FlexGrid.OwnerDrawCellEventArgs) Handles C1FlexGrid1.OwnerDrawCell If e.Row >= Me.C1FlexGrid1.Rows.Fixed And Me.C1FlexGrid1.Cols(e.Col).Name = "Password" Then e.Text = New String("*"c, e.Text.Length) End If End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
private void c1FlexGrid1_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e) { if (e.Row >= this.c1FlexGrid1.Rows.Fixed && this.c1FlexGrid1.Cols[e.Col].Name == "Password") { e.Text = new string('*', e.Text.Length); } } |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.C1FlexGrid1(1, 1) = "123456" |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1FlexGrid1[1,1] = "123456"; |
Run the project again and notice the numbers are automatically loaded onto the form in the Password column as asterisks.