简单排错,“参数不可选”,里面有三行代码,跟上鬼了,大家帮忙看一下!

signboy 2004-06-24 09:30:43
一个类中有如下一个函数,编译不能通过,说什么参数
不可选,如果Collection换成integer就可以,why??

Public Function getCount() As Collection
Dim reports As New Collection
getCount = reports
End Function
...全文
122 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Sunron128 2004-06-24
  • 打赏
  • 举报
回复
將getCount = reports改寫成 set getCount = reports
victorycyz 2004-06-24
  • 打赏
  • 举报
回复

Public Function getCount() As Collection

Dim reports As New Collection
reports.Add "abc", "a"

Set getCount = reports

End Function

Private Sub Command1_Click()

Print getCount("a")

End Sub
netcrawller 2004-06-24
  • 打赏
  • 举报
回复
Public Function getCount() As Collection
Dim reports As New Collection
'getCount = reports
set getCount = reports '这样呢
End Function

7,785

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧