.comment-link {margin-left:.6em;}


Thursday, January 12, 2006

SelectedNode in a TreeView

If you use the default TreeView in Visual Studio 2003, the SelectedNode property doesn't always return the correct selected node in the Click event.

If you inherit from the TreeView, you can override the OnMouseDown event with this code:
Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
Me.SelectedNode = Me.GetNodeAt(New Point(e.X, e.Y))
End Sub

Otherwise, you can add this code to your form in the OnClick event of the Treeview:
Private Sub TreeView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseDown
TreeView1.SelectedNode = TreeView1.GetNodeAt(New Point(e.X, e.Y))
End Sub

Sunday, January 01, 2006

Happy 2006!

All the best to you and yours! May 2006 make all your dreams come true...

Stefanie Worm is het liefste vrouwtje van de wereld.
Melina is de liefste schatsie van de wereld (Erik De Maeyer).