DataGridViewTextBoxColumn中的密码字符 [英] Password character in DataGridViewTextBoxColumn

查看:156
本文介绍了DataGridViewTextBoxColumn中的密码字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用DataGridviewTextboxColumn在DataGridView中显示系统密码字符.

准备网格时,我想绑定到密码字符.

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

推荐答案

系统密码字符"是什么意思.

您是说有人在列中键入数据时必须将其隐藏并看起来像"*******"吗?

如果是这样,您将需要创建一个自定义DataGridColumnStyle类

您的类将必须继承自DataGridColumnStyle类或诸如DataGridTextBox类之类的现有类.

代码项目 DataGrid ColumnStyle作为LinkLabel 中有一些自定义DataGridColumnStyles的示例.

还有有关如何执行此操作的MSDN文章.
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.


这篇关于DataGridViewTextBoxColumn中的密码字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆