datagridview显示问题 我的datagridview是调用一个xml文件中的数据的,xml文件里有个节点为“Password”,我想在datagridview里“Password”显示“*”,也就是密码形式的,该怎么解决啊,请高手指点啊,谢谢了啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 DateTime dat1 = new DateTime(2008, 12, 12);DateTime dat2 = new DateTime(2008, 12, 15);if (dat1 > dat2){ //dat2在前了}else if (dat1 == dat2){ //一样}else{ //dat1在前} 你的xml文件作为数据源时有没有赋给datatable这类可改动的数据源?如果有你可以先改其值再绑定 private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { // 把第4列显示*号,*号的个数和实际数据的长度相同 if (e.ColumnIndex == 3) { if (e.Value != null && e.Value.ToString().Length > 0) { e.Value = new string('*',e.Value.ToString().Length); } } } // 编辑单元格控件事件 private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { // 编辑第4列时,把第4列显示为*号 TextBox t = e.Control as TextBox; if (t != null) { if (this.dataGridView1.CurrentCell.ColumnIndex == 3) t.PasswordChar = '*'; else t.PasswordChar = new char(); } } CellFormatting事件直接在dataGridView的事件里双击就成了哇~~然后把列换成你的~ 谢谢楼上啊,请问下“直接在dataGridView的事件里双击就成了哇”是什么意思啊? 请教关于条形码的问题 C#如何实现阻止电脑关机??? 如何判断关闭当前焦点所在子窗体? 兼容性? 关于wince 下C#控制进程的问题 DevExpress V2.0控件中的DateEdit控件,怎样把其按钮上的英文改成中文? C#的程序,里面有很多ABCDEF,求指导,求反编译方法 Webbrowser无法播放Flash System.Console.WriteLine("Hello World");信息在哪儿看到? 关于MPEG,问题比较难,分不够可以再开帖子加。 protected 问题? 如何用反射来读取Com组件里类,并创建该类的对象
DateTime dat2 = new DateTime(2008, 12, 15);
if (dat1 > dat2)
{
//dat2在前了
}
else if (dat1 == dat2)
{
//一样
}
else
{
//dat1在前
}
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
// 把第4列显示*号,*号的个数和实际数据的长度相同
if (e.ColumnIndex == 3)
{
if (e.Value != null && e.Value.ToString().Length > 0)
{
e.Value = new string('*',e.Value.ToString().Length);
}
}
}
// 编辑单元格控件事件
private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
// 编辑第4列时,把第4列显示为*号
TextBox t = e.Control as TextBox;
if (t != null)
{
if (this.dataGridView1.CurrentCell.ColumnIndex == 3)
t.PasswordChar = '*';
else
t.PasswordChar = new char();
}
}
CellFormatting事件直接在dataGridView的事件里双击就成了哇~~然后把列换成你的~