【问题标题】:DataGridViewCell event sequenceDataGridViewCell 事件序列
【发布时间】:2016-12-19 22:33:03
【问题描述】:

如果我重复另一个问题但我找不到相关答案,我深表歉意。
我在DataGridView 中有数据绑定列。有问题的列绑定到数据对象的decimal 字段,需要以decimal 提交到database 但是,当用户输入string 时,我需要将某些string 值转换为decimal。示例:当用户进入 M12 时,他/她一离开单元格,就需要将其转换为 decimal 值 0.4724。我有一个方法可以使用string 并返回正确的decimal,但我找不到正确的event 来处理。我选择的所有事件都太晚了,在我将string 转换为decimal 之前,我最终得到了例外。我应该处理什么事件? `

【问题讨论】:

    标签: c# .net datagridview


    【解决方案1】:
    private void dataGridView1_CellLeave(object sender, 
        DataGridViewCellEventArgs e)
    {
        dataGridView1[e.ColumnIndex, e.RowIndex].Style
            .SelectionBackColor = Color.Empty;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-03-21
      • 2014-01-10
      • 1970-01-01
      • 1970-01-01
      • 2015-05-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多