Click here to Skip to main content
15,303,572 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi All,
I Have three rows with edit, delete, save buttons. I have hided save button on form load. now i want to hide unhide save button and hide edit button on clicking edit button only in selected row.

I tried using columns[columnIndex].visible = false;

this.DataGridView1.Columns[0].Visible = false;
          this.DataGridView1.Columns[1].Visible = true;

But it hides all columns with that index. I want only the selected rows column to be changed leaving other columns unchanged.
Updated 22-Mar-15 8:39am

1 solution

The easiest solution would be to set the ReadOnly property to true.

Another approach could be to make the cell style transparent.
Style = { ForeColor = Color.Transparent,SelectionForeColor = Color.Transparent }

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900