Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Unable to hide a first row of a datagridview when multiple rows exists in the datagridview.
when i hide second third upto n of the rows in the datagridview it is hidding, why not for first row pls help.

Here is my code

CurrencyManager currencyManager1 = (CurrencyManager)BindingContext[DataGridView1.DataSource];
currencyManager1.SuspendBinding();
DataGridView1.Rows[e.RowIndex].Visible = false;
currencyManager1.ResumeBinding();
Posted
Comments
Francine DeGrood Taylor 5-Jun-14 12:19pm    
Are you sure that your RowIndex is on the first row? Might you be pointing at the header row? Check the object bound to the row and see if it has the data which you are expecting.

1 solution

Hello friend, you may try this:
C#
// to hide first row in DataGridView control
DataGridView1.Rows[0].Visible = false;

- DD
 
Share this answer
 
Comments
Member 8653959 8-Jun-14 9:17am    
Thanks for your answer
i tried that coding it works only if i have one row in datagridview.
see the problem occurs when i have multiple rows (consider i have 5 rows) if i try to make 1 row visible false there its not hiding.
Debabrata_Das 8-Jun-14 9:31am    
Hi, please check if you are calling DataBind() method before you set visible false. It should work for multiple rows as well. If still the issue not resolved, please share your method.
- DD

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