Two properties on the TreeView TreeNodes are especially tricky. They are the Expanded and the ShowCheckBox properties. And they've changed between Beta2 and the RTM. The reason they are tricky is that their behavior can be explicitly set or implicitly set through the parent TreeView control. Here's an example. Lets say you have a tree that looks like this:

And you want it expanded to a depth of 2 except that "Node 2.1" should not be expanded. Then to do this, you would set the TreeView to to an expand depth of 2 and that particular nodes expanded to false in the node editor
And you get this:

It may not seem obvious but in order to accomplish this we need a tri-state variable type. This is a type that has 3 values: True, False, and {other}. In Beta2 we rolled-our-own special type for this called an OptionalBoolean and {other} was called "NotSet". But this was a lot of extra work, custom to only the TreeView and, as it turns out, .NET 2.0 already supports a tri-state type called a NullableBoolean. So, for the RTM, the decision was made to use it instead, now {other} is "Null" or "Nothing".
It looks like this:

However, this does cause a couple issues for some C# code. (I'm showing Expanded here but ShowCheckBox will act similarly)

It is interesting to point out that the above code won't have this limitation in VB. VB can implicitly cast the True or False values of a NullableBoolean while C# cannot. However, the code construct isn't really robust in VB. The nodes Expanded and ShowCheckBox state initially start out as Nothing and then later on get set to their appropriate values. You could still get an exception testing it like that.

So, what should you do? There are a couple of solutions but the very best one in this case is to explicitly specify the test:
| VB: If TreeView1.Nodes(0).Expanded = True Then 'some work here End IF 'in this case we're explicitly testing for if Expanded is True and therefore Nothing and False will fall through. | C#: if( TreeView1.Nodes[0].Expanded == false ) { //some work here } // in this case we're explicitly testing for if Expanded is false and therefore null and true would fall through. |
However, since it is a .NET Framework Nullable type, you can use any of the nullable operators and operations on it. Here's are a couple links to msdn articles about Nullable types:
http://msdn.microsoft.com/vcsharp/2005/overview/language/nullabletypes/
http://winfx.msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_csref/html/0bacbe72-ce15-4b14-83e1-9c14e6380c28.asp