July 26, 2000

Limit the length of the text in a TreeView node

The TreeView control doesn’t expose any property that lets you limit the amount of text users can type when editing a Node’s label. However, you can do the trick with a couple of SendMessage API calls from within the BeforeLabelEdit event: with the TVM_GETEDITCONTROL message you retrieve the handle of

Workaround for SendKeys

Sendkeys “{TAB}” can lockup the keyboard in Windows 2000. Here’s how toexecute a tab in the keydown event using the Win32 API to get around thisWindows 2000 bug: Private Sub text1_KeyDown(KeyCode As Integer, Shift As Integer)Dim l As Long l = PostMessage(hwnd, WM_KEYDOWN, VK_TAB, 0)End SubPublic Declare Function PostMessage Lib