I am trying to setup a treeview control to display all drives and folders on the PC. So far I can display all drives and folders but the images will not show except rarely. I am using an imagelist with 4 images (index 0-3). The code below is used to load the drives in the treeview control. I have tried using every type of image possible from bmp to png and nothing. I have tried the Appllication.EnableVisualStyles() which I now know isn't needed in vs 2008. I am also having problems with a picturebox in another form that shows nothing but a shadow of the image. I suspect this may be a setting somewhere maybe in vs 2008 but am not able to find one.
Treeview Code:
Dim drive As Integer = 0, dir As Integer = 0 For drive = 0 To oDrives.Length - 1 Dim oNode As New TreeNode Try oNode.ImageIndex = 3 oNode.SelectedImageIndex = 3 oNode.Text = oDrives(drive).ToString.Substring(0, 2) tvFolders.Nodes.Add(oNode) oNode.Nodes.Add("") Catch ex As Exception MsgBox("Cannot create initial node: " & ex.ToString) End Try Next End Sub
I will appreciate any ideas on this.




Reply With Quote
