Hi,
I'm unable to add a picture to ImageList control :
My form contains :
Image1 As Image
ImageList1 AS ImageList
ListView1 As ListView
Dim elem As Element
Dim pict As StdPicture
Set elem = Application.CreateCellElement3("mycellname", Point3dZero, True) Set pict = elem.GetPicture(256, 128) SavePicture pict, "c:\temp\mycellname.bmp"
Set Me.Image1.Picture = pict OK
but Me.ImageList1.ListImages.Add , "im1", LoadPicture("c:\temp\mycellname.bmp")
or Me.ImageList1.ListImages.Add , "im1", pict
provide Err 481
Any idea ?
TIA
Unknown said:.ImageList1.ListImages.Add
I would trawl web sites that specialise in VB/VBA. There are a lot more people out there who use VBA on other products (e.g. Excel, Word) than there are on MicroStation.
For example ...
Regards, Jon Summers LA Solutions
Thank you Jon. But I already checked them. I get error 481 only with a picture produced by element.GetPicture method and only when adding to ImageList:
Set elem = Application.CreateCellElement3("mycellname", Point3dZero, True)
Set pict = elem.GetPicture(256, 128)
Me.ImageList1.ListImages.Add , "im1", pict => ERROR
Set Me.Image1.Picture = pict => OK
Me.ImageList1.ListImages.Add , "im1", LoadPicture("C:\Program Files\Bentley\MicroStation V8i (SELECTseries)\MicroStation\bentleyb.jpg") => OK
That's why I posted on this forum
Unknown said:Err 481
This Microsoft article may help.
Thanks Jon, but I tried it without success
Is this running in MicroStation or outside?
Thanks,
mark anderson [Bentley]
Visit me at https://communities.bentley.com/communities/other_communities/bentley_innovation/default.aspx
Inside... I've joined my test mvba
TIA Mark
What DLL or OCX provides your ImageList?
mscomctl.ocx 6.01.9834
I've tried to unregister it then register again but no change.
Unknown said:mscomctl.ocx 6.01.9834
Try using a different version of the Microsoft Common Controls. Not always the latest is the best when dealing with VBA. VBA is really Visual Basic 5½, so an earlier version of the Common Controls may work better than the most recent version.
For example, in a recent project I found that the ListControl (a more feature-rich version of a ListView) wouldn't work when I used the most recent Common Controls. I had to back off to an earlier version to get it to work with VBA.
Thanks Jon,
I tried some different versions of Microsoft Common Controls but I still get the same error.I drop the idea to use ImageList with GetPicture feature since my program must run on Win XP, Vista and Windows 7 and it's already hard enough to manage ocx versions !
Regards