Jonathan Hilgeman

Everything complex is made up of simpler things.

Hiding TreeNodes in C#

Dec-9-2013

In a recent project, I was building out a TreeView control that could be searched and filtered. One of the primary problems was that there was no proper way to hide a TreeNode temporarily. The solution was fairly simple, though, and performed very well.

1. I started by created a new class that extended the base TreeView class.

2. Inside the new class, I defined a public TreeView called tvHidden, which held the nodes that were temporarily hidden.

3. I then added two public methods, Hide and Show, which both accepted a TreeNode as a parameter.

4. In the Hide method, I used the TreeNode’s Tag to store a reference to the original parent (Node.Parent), then removed the node from its current collection and added it to the tvHidden Nodes collection.

5. In the Show method, I removed the node from its current collection, then cast the Node.Tag back to its proper original TreeView or TreeNode value, and then added the node object back into that parent’s Nodes collection.

Presto! A simple, efficient solution for temporarily hiding TreeNodes!

The full version of the class implements a custom structure to stuff more custom data into the Node.Tag property, a Dictionary to look up nodes by name (no matter which TreeView they’re in), and support for copying parent structures.

Napster Bad!

Apr-19-2010

I tried Napster long ago and decided to give it another shot based on a review on another site.

Overview: 6 bad marks, 2 good marks

BAD: Inconvenience

I was looking for a specific album, so I wanted to see if they had it BEFORE I signed up, but they don’t have an easy way to do it.

Read the rest of the article...

Experts Exchange Activity

Aug-2-2009

Lately, I’ve been been a bit more active on Experts Exchange. I’ve been a member since 1998, but I’ve just recently become a little more active in answering questions. I’ve been writing more technical articles and posting them only on Experts Exchange to help build up their new Articles area. I re-posted my E-mail Delivery blog (with a few enhancements and tweaks), as well as four other articles:

Read the rest of the article...

Version Control – SVN vs. VSS vs. Git

Jul-16-2009

Someone asked a question about version control software on Experts Exchange recently, and my answer turned into potential blog material:

Version Control Concepts

I’ve used Subversion (SVN), Visual SourceSafe (VSS), and Git. The concepts are all the same, though. Version control basically means that all of your application files are “checked in” to a big container (called a repository) that sits in some central location (usually a server) that your developers can all access.

Read the rest of the article...