C# 报错 不包含XX
private void dataGridView1_CurrentCellChanged(object sender, EventArgs e){
dataGrid1.CaptionText = dataGrid1[dataGrid1.CurrentRowIndex, 1].ToString();
}
错误 1 “System.Windows.Forms.DataGridView”不包含“CaptionText”的定义,并且找不到可接受类型为“System.Windows.Forms.DataGridView”的第一个参数的扩展方法“CaptionText”(是否缺少 using 指令或程序集引用?)
错误 2 “System.Windows.Forms.DataGridView”不包含“CurrentRowIndex”的定义,并且找不到可接受类型为“System.Windows.Forms.DataGridView”的第一个参数的扩展方法“CurrentRowIndex”(是否缺少 using 指令或程序集引用?)
谢谢 --------------------编程问答-------------------- 错误2 我改成CurrentCell.RowIndex 就对了 请问
错误1怎么该啊 --------------------编程问答-------------------- 说实话我真不明白你的代码写的是什么意思 --------------------编程问答-------------------- 错误2 你应该改为[e.RowIndex] --------------------编程问答-------------------- dataGridView1_CurrentCellChanged
与
dataGrid1.CaptionText ? --------------------编程问答-------------------- CaptionText和CurrentRowIndex事DataGrid的成员而不是DataGridView的成员
DataGrid是.net1.1的东西,在.net2.0中被DataGridView代替了。
不过2.0为了保持向前兼容性依然包含DataGrid
把你的控件换成DataGrid。或者使用DataGridView的属性。
补充:.NET技术 , C#