How would you attach pictures in Treeview Control?



How would you attach pictures in Treeview Control?..

Answer / Ziaur Rahman

To attach a picture (icon) to a node in a TreeView control, set the ImageKey property of the TreeNode object to an image list key. First, create an ImageList object and add images to it, then assign the ImageList object to the TreeView's ImageList property. Finally, set the ImageKey property of the TreeNode to the desired image key.n`vbnetnDim myImageList As New ImageList()nmyImageList.Images.Add(Image.FromFile("path_to_image_file"))nmyTreeView.ImageList = myImageListnDim newNode As New TreeNode("New Node", myImageList.Images(0))nmyTreeView.Nodes.Add(newNode)

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Visual Basic Interview Questions

What is VB ShellScripting?

1 Answers   Wipro,


How does a DCOM component know where to instantiate itself?

1 Answers   Synechron,


How do I use GetPrivateProfileString to read from INI files?

1 Answers  


Name some date functions?

1 Answers  


How do I access C style strings?

1 Answers  


What are the different types of Dialog Box?

2 Answers   Apollo, ATTC,


Explain the types of Views in Listview Control?

1 Answers   Hella,


What is the difference between a property a method and an event? Give an example of each.

18 Answers   Microsoft,


What is a thread pool and how are the threads within a thread pool managed?

1 Answers  


Which language is used in visual basic?

1 Answers  


What is the difference between Msgbox Statement and MsgboxQ function?

1 Answers  


How do I make an animated icon for my program?

1 Answers  


Categories