So in my project i would like have a nice treeview that has images.
but when i run the program the image was not shown. Any idea?
here is my code:
while (thisreader.Read()) // i read from the database.
{
TreeNode tn = new TreeNode();
tn.Text = thisreader["channel_name"].ToString();
tn.ImageIndex = 1;
tn.SelectedImageIndex = 1; // i have my imagelist1 in the corresponding winform
treeView1.Nodes.Add(tn);
}
The
ImageListmust be assigned to theImageListproperty of theTreeViewas well. Simply dropping it on the form is not enough.