jeudi 14 mai 2020

i Want to make individual textbox cell readable based on checkboxColumn in C# datagridview

enter image description here

I wanted to make textbox column single cell readonly to false based on checkbox. if a checkbox is checked then rextbox would be writable.

        private void dgvItem_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        { bool valid = Convert.ToBoolean(this.dgvItem.CurrentRow.Cells[0].Value.ToString()); //null reference exception
            if(valid)
            {
                this.dgvItem.CurrentRow.Cells[3].ReadOnly = false;
            }
        }

s checkd then cell would writable. but i get

null reference exception everytime




Aucun commentaire:

Enregistrer un commentaire