Click here to Skip to main content
15,900,714 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have to display the system password character in a DataGridView using DataGridviewTextboxColumn.

I want to bind to the password character when I prepare the grid.

Dim dc As DataGridViewTextBoxColumn

dc = New DataGridViewTextBoxColumn
dc.HeaderText = "Card"
dc.Name = "card"
dc.DataPropertyName = "Cradname"
dc.MaxInputLength = 16
dc.Width = 150
gdvCollection.Columns.Insert(gdvCollection.Columns.Count - 1, dc)
dc = New DataGridViewTextBoxColumn
dc.Name = "Card1"
dc.HeaderText = "Cardname1"
dc.MaxInputLength = 16
dc.Width = 150
'If gdvCollection.Columns.Count = 9 Then gdvCollection.Columns.Remove("VeriyCCNo")
gdvCollection.Columns.Insert(gdvCollection.Columns.Count - 1, dc)
gdvCollection.Columns("Card").SortMode = DataGridViewColumnSortMode.NotSortable
gdvCollection.Columns("Card1").SortMode = DataGridViewColumnSortMode.NotSortable
Updated 22-Dec-09 23:05pm

1 solution

What do you mean by "system password character".

Do you mean that when someone types data into the column it must be hidden and look like "*******"?

If so you will need to make a custom DataGridColumnStyle class

Your class will have to inherit from either the DataGridColumnStyle class or one of the existing classes like DataGridTextBox class.

There are examples of custom DataGridColumnStyles in codeproject DataGrid ColumnStyle as LinkLabel.

And MSDN articles on how to do that.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900