我的datagridview是调用一个xml文件中的数据的,xml文件里有个节点为“Password”,我想在datagridview里“Password”显示“*”,也就是密码形式的,该怎么解决啊,请高手指点啊,谢谢了啊

解决方案 »

  1.   

    DateTime dat1 = new DateTime(2008, 12, 12);
    DateTime dat2 = new DateTime(2008, 12, 15);
    if (dat1 > dat2)
    {
        //dat2在前了
    }
    else if (dat1 == dat2)
    {
        //一样
    }
    else
    {
        //dat1在前
    }
      

  2.   

    你的xml文件作为数据源时有没有赋给datatable这类可改动的数据源?如果有你可以先改其值再绑定
      

  3.   


            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);
                    }
                }
            } 
      

  4.   


            // 编辑单元格控件事件
            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();
                }
            } 
      

  5.   


    CellFormatting事件直接在dataGridView的事件里双击就成了哇~~然后把列换成你的~
      

  6.   

    谢谢楼上啊,请问下“直接在dataGridView的事件里双击就成了哇”是什么意思啊?