title: Hiding particular datagridview cell in c#
body: <p>I have a datagridview in windows form. Datagridview looks like below:</p>
  <p><a href="https://i.stack.imgur.com/NX0q9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NX0q9.png" alt="enter image description here" /></a></p>
  <p>In this, have one Checkbox column, two textbox column.</p>
  <p>My requirement is need to hide checkbox from the cell for the country has Germany as like below.</p>
  <p><a href="https://i.stack.imgur.com/sHy5G.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sHy5G.png" alt="enter image description here" /></a></p>
  <p>For this, I tried by two ways:</p>
  <ol>
  <li><p>By setting visible property as false.</p>
  <p><code>datagridview.Rows[rowIndex].Cells[columnIndex].visible = false;</code></p>
  </li>
  </ol>
  <p>When using visible property, it showing error like cannot assigned to readonly.</p>
  <ol start="2">
  <li><p>Trying by converting the type of datagridview cell from checkbox to textbox for the particular cell.</p>
  <p><code>DataGridViewTextBoxCell textBoxCell = new DataGridViewTextBoxCell();</code>
  <code>datagridview.Rows[rowIndex].Cells[columnIndex] = textBoxCell;</code></p>
  </li>
  </ol>
  <p>For this, I am getting error like &quot;Formatted value of the cell has a wrong type&quot;.</p>
  <p>Is anyone have idea for this?</p>