循环访问DataGridView行,设置外键问题

youqiong 2007-04-05 10:45:10
foreach (DataGridViewRow row in dataGridView1.Rows)
{
row.Cells[dELIVERIDDataGridViewTextBoxColumn.Index].Value = this.dELIVER_IDTextBox.Text;
}

不能设置GridView中所有行,
...全文
261 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
youqiong 2007-04-05
  • 打赏
  • 举报
回复
方法不对头?
youqiong 2007-04-05
  • 打赏
  • 举报
回复
//for (int cnt = 0; cnt < dataGridView1.Rows.Count; cnt++)
//{
// dataGridView1.Rows[cnt].Cells[dELIVERIDDataGridViewTextBoxColumn.Index].Value = this.dELIVER_IDTextBox.Text;
//}


//foreach (DataGridViewRow row in dataGridView1.Rows)
//{
// row.Cells[dELIVERIDDataGridViewTextBoxColumn.Index].Value = this.dELIVER_IDTextBox.Text;
//}


两种效果一样
yudi010 2007-04-05
  • 打赏
  • 举报
回复
int num= this.DataGrid1.Items.Count;
for(int i=0;i<num;i++)
{
。。。。。。。。。。。。
}
wsj1983920 2007-04-05
  • 打赏
  • 举报
回复
用for循环把
youqiong 2007-04-05
  • 打赏
  • 举报
回复
跟踪进去,发现
获取共享行的 InheritedStyle 属性是无效的操作。
wsj1983920 2007-04-05
  • 打赏
  • 举报
回复
ding
youqiong 2007-04-05
  • 打赏
  • 举报
回复
如 共 3行

第2行访问不了

5行

2,4行访问不了
xinzhulu 2007-04-05
  • 打赏
  • 举报
回复
差哪行
ylqmf 2007-04-05
  • 打赏
  • 举报
回复
up

110,571

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧