Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am creating a custom datagrid that inherits the windows forms datagrid. What i do on load is create teh 6 columns i need. I want to at run time however, be able to hide or unhide each column. I do not want to set its width to 0. So i created a new collection ( contains hidden columns ). And add the column i want to hide to this collection, then remove it from the datagrids collection. Everything works fine.

To show it again, i add the column from my colletion to the datagrids collection. Everything works fine, until i try and remove the Column from my "hidden column Collection". It crashes and says object reference not found.

 

 

Anyone got any ideas. I dont quite understand why i cant do this.

Posted
One other thing. It doesnt throw the error, until the column i just unhide is the viewable area of the datagrid. So if its not in the viewable region and i have to scroll to see it, it throws the error the instance the column is viewable.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...