2014-02-17 39 views
0

我在窗体上工作..
我有一个数据网格视图说(3列)。我想禁用第三列,如果我没有数据在第一,两列。
如果我有前两列数据,那么第三个栏应使..禁用第三列的数据网格视图,如果前两列有数据

我喜欢thise

数据网格视图enter image description here

如果前两个栏有一些数据的话,我已经进入了一些编号在第三列。其他明智我不想让第三列输入ID
我怎么能做到这一点?
任何帮助非常明显?

回答

1
String Cell1=dataGridView1.Rows[0].Cells[0].Value.ToString(); 
String Cell2=dataGridView1.Rows[0].Cells[1].Value.ToString(); 

if(String.IsNullOrWhiteSpace(Cell1) && String.IsNullOrWhiteSpace(Cell2)) 
{ 
dataGridView1.Rows[0].Cells[2].ReadOnly = true; 
} 
相关问题