做的程序,到用户那里,当进行DataGrid操作时,有时会显示“红色的叉”,是什么原因?有办法处理吗?
操作:
左边一个DataGrid,右边一个DataGrid,当双击左侧的DataGrid行,会将该行的Flag标识修改,刷新这两个DataGrid的数据源(重新绑定),以便使左侧双击的行移到右侧。
另外用户系统是英文的。
救我!

解决方案 »

  1.   

    有没有设置 datagrid的样式,如果有,仔细查查这部分代码有没有问题.
      

  2.   

    我用的就是VS2003,我的确用到了样式
    grd.TableStyles.Clear();
    grd.ReadOnly = true;
    DataGridTableStyle ts = new DataGridTableStyle();
    ts.MappingName = dt.TableName;            //映射到Tables[0]
    ts.AllowSorting = false; //模式
    DataGridTextBoxColumn txtModeType = new DataGridTextBoxColumn();
    txtModeType.HeaderText = "模式";
    txtModeType.MappingName = "ModeTypeName"; //映射的列名
    txtModeType.Width = 50;
    txtModeType.ReadOnly = true;
    ts.GridColumnStyles.Add(txtModeType); DataGridTextBoxColumn txt1 = new DataGridTextBoxColumn();
    txt1.HeaderText = "软件名称";
    txt1.MappingName = "MPN"; //映射的列名
    txt1.Width = 120;
    txt1.ReadOnly = true;
    ts.GridColumnStyles.Add(txt1); DataGridTextBoxColumn txt5 = new DataGridTextBoxColumn();
    txt5.HeaderText = "中文名称";
    txt5.MappingName = "ChineseHint"; //映射的列名
    txt5.Width = 100;
    txt5.ReadOnly = true;
    ts.GridColumnStyles.Add(txt5); if (IsEdit)
    {
    DataGridTextBoxColumn txt2 = new DataGridTextBoxColumn();
    txt2.HeaderText = "所占比例";
    txt2.MappingName = "Proportion";
    txt2.ReadOnly = true;
    txt2.Width = 60;
    ts.GridColumnStyles.Add(txt2); //添加数量
    DataGridTextBoxColumn txt3 = new DataGridTextBoxColumn();
    txt3.HeaderText = "数量";
    txt3.MappingName = "SoftwareQuantity";
    txt3.ReadOnly = true;
    txt3.Width = 50;
    ts.GridColumnStyles.Add(txt3);
    } DataGridTextBoxColumn txt4 = new DataGridTextBoxColumn();
    txt4.HeaderText = "全称";
    txt4.MappingName = "SoftwareNameHint";
    txt4.ReadOnly = true;
    txt4.Width = 300;
    ts.GridColumnStyles.Add(txt4); grd.TableStyles.Add(ts);
    }有什么问题吗?