摘要: 开发者经常会利用datagridview做添加,修改,删除操作,有时还要同步更新到数据库,有时需要修改整行,有时需要修改整列,有时修改多行,多列。现在先写个修改某一列的选中行的内容,借此抛砖引玉int Count=this.DataGridView1.SelectedCells.Count;DateTime dtStartTime123 = Convert.ToDateTime(this.dataGridView1.SelectedCells[0].OwningRow.Cells[1].Value.ToString()); startTime123 = dtStartTime123.ToStr 阅读全文
posted @ 2012-11-27 09:20 大笨鹰 阅读(435) 评论(0) 推荐(0) 编辑
摘要: DataGridView取得或者修改当前单元格的内容1.获取当前单元格的内容,选择了行则默认显示当前行的第一个单元格内容DataGridView1.CurrentCell.Value2.取得当前单元格的列的索引,从0开始DataGridView1.CurrentCell.ColumnIndex3. 取得当前单元格的行的索引,从0开始textBox1.Text= (dataGridView1.CurrentCell.RowIndex).ToString();4. 另外,使用 DataGridView.CurrentCellAddress 属性(而不是直接访问单元格)来确定单元格所在的行:Data 阅读全文
posted @ 2012-11-27 09:04 大笨鹰 阅读(1498) 评论(0) 推荐(0) 编辑