DataGridView单元格显示密码

DataGridView单元格显示密码

private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex == 1)
{
if (e.Value != null && e.Value.ToString().Length > 0)
{
e.Value = new string('*', e.Value.ToString().Length);
}
}
}

posted @ 2019-12-30 19:42  清语堂  阅读(331)  评论(0编辑  收藏  举报