设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1607|回复: 3
打印 上一主题 下一主题

[ActiveX] imagelist加载图片的问题

[复制链接]
跳转到指定楼层
1#
发表于 2012-4-14 14:31:34 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
尝试使用imagelist,但图片始终加不进去。一到add就出问题。说是type mismatch。不知道问题在哪里。

Private Sub Command1_Click()
Dim imgFolder As Folder
Dim imgFile As File
Dim fso As FileSystemObject
Dim imgList As ImageList
Dim imgX As ListImage
Set imgList = Me.ImageList0.Object
Set fso = New FileSystemObject
Set imgFolder = fso.GetFolder(CurrentProject.Path & "\icon")
For Each imgFile In imgFolder.Files
Set imgX = imgList.ListImages.Add(, imgFile.Name, imgFile.Path)
Next imgFile
MsgBox imgList.ListImages.Count
End Sub
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
 楼主| 发表于 2012-4-14 14:32:41 | 只看该作者
问题就出在set imgX=imgList.ListImages.add这里。
3#
发表于 2012-4-14 23:38:28 | 只看该作者
4#
发表于 2012-4-15 10:47:58 | 只看该作者
本帖最后由 Grant 于 2012-4-15 10:48 编辑

类型不匹配,看看你的声明和代码有什么地方错了,或者可以参考一下别人的例子,例如andymark提供的
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-8 17:36 , Processed in 0.098932 second(s), 27 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表