Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Password field in DataGridView displaying actual password, not masked
 

Password field in DataGridView displaying actual password, not masked

I'm using a datagridview to add new users to the table that accesses users names and passwords for access to the application. In the database, the field has a mask of '******' However, when the password is displayed in the datagridview, the actual password is displayed. Is there anyway of masking the password column? I don't see any property to change this when you "Edit Columns" for the datagridview.
Julie Missick  Thursday, January 15, 2009 5:56 PM

Hi Julie Missick,

We can change the exact display value by handling CellFormatting event. Please try the following code:

EventArgs e)

DataTable dt1 = new DataTable("customer");

"name");

"password");

"aa","aaa");

DataGridViewCellFormattingEventHandler(dataGridView1_CellFormatting);

DataGridViewCellFormattingEventArgs e)

String('*', e.Value.ToString().Length);

The following link is for your reference.

DataGridView.CellFormatting Event

If you have any other questions, please feel free to ask.

Best regards,

Ling


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Sunday, January 18, 2009 8:53 PM

Hi Julie Missick,

We can change the exact display value by handling CellFormatting event. Please try the following code:

EventArgs e)

DataTable dt1 = new DataTable("customer");

"name");

"password");

"aa","aaa");

DataGridViewCellFormattingEventHandler(dataGridView1_CellFormatting);

DataGridViewCellFormattingEventArgs e)

String('*', e.Value.ToString().Length);

The following link is for your reference.

DataGridView.CellFormatting Event

If you have any other questions, please feel free to ask.

Best regards,

Ling


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Sunday, January 18, 2009 8:53 PM

You can use google to search for other answers

Custom Search

More Threads

• trackbar databinding
• Boolean Data in Access an VB.net
• public IList GetItems()
• Binding controls to nullable fields in strongly type dataset rows
• BindingSource GridView No Selection
• No New Line for DataGridView
• DateTimePicker Problems
• Data Detail View Using Visual Studio Express (C#)
• How to implement virtual mode with a DataGridView, DataView, and DataTable
• Could not bind ... ValueMember