Selectively removing checkboxes in a .NET 1.1 / 2.0 TreeView

Earlier this month, I had the need to customise a TreeView control such that it had checkboxes against some, not all, of the nodes.

Here’s a screenshot of what I wanted:


It requires a little bit of code to achieve this effect, but is was worth the effort. Here’s the code that performs the magic:

[code lang=”C#”]
using System.Runtime.InteropServices;

namespace Treeview___CheckBoxes
public partial class Form1 : Form
public Form1()

private void Form1_Load(object sender, EventArgs e)
// Iterate over the root nodes, removing their checkboxes
for (int n = 0; nTechnorati Tags: , , ,

GSOH at The Code Project

It’s good to see that the folks over at The Code Project have a sense of humour! I came across the message below whilst browsing their site.

Hear that crunching sound? Something just broke.

Why did this happen?
Because either we screwed up in a way that wasn’t immediately obvious until now, or because the ASP engine running this site has just rolled over and died, or because the site is simply having a bad hair day.

Try and do whatever you did again. Try again.

Open the CodeProject home page, and then look for links to the information you want. Sure, the information you need is probably on this page, but you never know your luck in a big city.
Pray, curse, or sacrifice burnt offerings, then see 1.

The Error
The Page: : /vb/net/CustomDrawTreeview.asp
The Time: : Sunday, April 09, 2006, 1:19:58 PM
The Server: : Web09
The Error No. : 0x80004005. Remember this number. There will be a test.
The Category : Microsoft VBScript compilation

Microsoft Technical Roadshows 2006

It’s that time of year again – Microsoft hit the road!

Join Microsoft at their 2006 Technical Roadshows across the UK, save these dates:

02/05/06 Birmingham National Motor Cycle Museum
22/05/06 Edinburgh Dynamic Earth
06/06/06 Manchester Manchester Conference Centre
15/06/06 London (City) Immarsat Centre
21/06/06 Bristol The Watershed

03/05/06 Birmingham National Motor Cycle Museum
23/05/06 Edinburgh Dynamic Earth
07/06/06 Manchester Manchester Conference Centre
14/06/06 London (City) Immarsat Centre
20/06/06 Bristol The Watershed

Edinburgh attendees – please note the change of venue: these events are not being held in The Corn Exchange!

Register via here.