Click here to Skip to main content
15,896,359 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;

C#
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.
Posted
Updated 22-Mar-15 8:39am
v3

1 solution

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

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

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