ste123 Posted July 28, 2005 Posted July 28, 2005 OK, im new to VB.NET but have been a visual fox developer for seven years or so. what I'm trying to do is create a listview in detail view with some graphical icons down the side, easy you may think but Ive been going at this for around 4 days now (on and off) and I cant get it to do anything. does anyone know how to populate an imagelist programmaticall so I can attach images (at runtime) into the listview by use of a key (an index will do at the moment) dim imagex as image dim imagelistx as new ImageList imageListx.Images.Item(1).FromFile("g:\hd\datadev\graphics\add.bmp") me.ListView1.SmallImageList = imageListx me.ListView1.Items.Add("test 1") me.ListView1.Items(1).ImageIndex = 1 me.ListView1.Items.Add("test 2") me.ListView1.Items(2).ImageIndex = 1 me.ListView1.Items.Add("test 3") me.ListView1.Items(3).ImageIndex = 1 me.ListView1.Items.Add("test 4") me.ListView1.Items(4).ImageIndex = 1 it dosent work. if anyone could help I would be forever greatful. and its my 30th birthday today so I'd really like to get this going. Any resources would be helpfull. Thanks in advance. Steve. Quote
woklet Posted July 28, 2005 Posted July 28, 2005 Hello fellow Fox coder... I think I may have some code that would be helpful. imageList.Images.Add(Bitmap.FromFile("c:\weblookup\exclem.ico")) imageList.Images.Add(Bitmap.FromFile("c:\weblookup\misc02.ico")) lbHistory.SmallImageList = imageList Me.lbHistory.Items.Add(strWork, 0).ForeColor = System.Drawing.Color.Fuchsia These four lines of code should come in handy. Let me know if you need further help. I'm doing this in the current VB.NET app I'm working on; so I ought to be able to help... Good luck Ben Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.