background image

End Sub

[C#]

private void

 DataGridView1_CellBeginEdit(

object

 sender,

    DataGridViewCellCancelEventArgs e)

{

    DataGridView dgv = (DataGridView)sender;

    

if

 (dgv.Columns[e.ColumnIndex].Name == "Column1" &&

        !(

bool

)dgv["Column2", e.RowIndex].Value)

    {

        e.Cancel = 

true

;

    }

}

3.DataGridView 最下面一列新追加行非表示

[VB.NET]

'DataGridView1 にユーザーが新しい行を追加できないようにする

DataGridView1.AllowUserToAddRows = 

False

[C#]

//DataGridView1 にユーザーが新しい行を追加できないようにする