首页 新闻 会员 周边 捐助

dataset 数据批量提交时的问题

2
悬赏园豆:50 [已关闭问题] 关闭于 2011-11-01 10:07

dataset 数据集数据发生了变化,但是,HasChanges()则返回为false。

我自我感觉是如下代码出了问题,但是不知道该怎么解决,请高手帮忙看看。

 private DataGridCell editCell;
        private bool inEditMode = false;
        private bool inUpdateMode = false;
        private void dataGrid1_CurrentCellChanged(object sender, EventArgs e)
        {
            if (!inUpdateMode)
            {
                if (inEditMode && !dataGrid1.CurrentCell.Equals(editCell))
                {      // Update edited cell   
                    UpdateTextBoxNum();
                }
                // Enter edit mode   
                if (dataGrid1.CurrentCell.ColumnNumber == 2)
                {
                    editCell = dataGrid1.CurrentCell;
                    txtEdit.Text = (string)dataGrid1[editCell.RowNumber,
                        editCell.ColumnNumber];
                    txtEdit.Focus();
                    txtEdit.Select(0, txtEdit.Text.Length);
                    Rectangle cellPos = dataGrid1.GetCellBounds(editCell.RowNumber,
                        editCell.ColumnNumber);
                    txtEdit.Left = cellPos.Left;
                    txtEdit.Top = cellPos.Top + dataGrid1.Top;
                    txtEdit.Width = cellPos.Width;
                    txtEdit.Height = cellPos.Height;
                    txtEdit.Visible = true;
                    inEditMode = true;
                }
            }
        }

        private void UpdateTextBoxNum()
        {
            inUpdateMode = true;
            dataGrid1.Visible = false;
            DataGridCell currentCell = dataGrid1.CurrentCell;
            dataGrid1[editCell.RowNumber, editCell.ColumnNumber] = txtEdit.Text;
            dataGrid1.CurrentCell = currentCell;
            dataGrid1.Visible = true;
            inUpdateMode = false;
            txtEdit.Visible = false;
            inEditMode = false;
        }

问题补充:

等了好久都没等到一个人啊?

後浪的主页 後浪 | 小虾三级 | 园豆:830
提问于:2011-05-19 16:47
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册