Joined: 18 Jul 2005
|Posted: Thu Sep 22, 2005 4:06 am Post subject: HOWTO : Manipulate FolderView, FileView or ShComboBox before the Form.Load event
|Manipulating FolderView, FileView and ShComboBox (such as setting the root node of FolderView or the current folder of FileView) has no effect if the operations are performed before the host form is loaded (before the Form.Load event). This occurs because the window handle corresponding to the control is not created before the Form.Load event.
The solution to this is to access the Handle property of the control to force the creation of the windows handle. Once this occurs, you can manipulate the controls normally.
dummy = fileView1.Handle; // Forces creation of the window handle
Dim dummy as IntPtr
dummy = fileView1.handle; ' Forces creation of the window handle