ParamArray参数的传递,可能是搞不定的了。请看代码。

foolishidea 2002-10-08 01:49:23
Public sub Test1(ParamArray Args())
call test2()'???????????参数怎么写
End sub


别人DLL中有一个像下面这样定义的方法
public sub test2(ParamArray Args())

End sub


现在要在Test1中调用Test2,并把Test1的参数Args传到Test2中去。注意:Test2不能改动,Test1怎么改都行。各位老大有没有什么好办法?
...全文
224 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
foolishidea 2002-10-08
  • 打赏
  • 举报
回复
好办法!
y1g1y1 2002-10-08
  • 打赏
  • 举报
回复
问题已解决!
演示程序去小站下载.

http://ygyuan.3322.net/
http://ygyuan.onchina.net/
foolishidea 2002-10-08
  • 打赏
  • 举报
回复
我现在用极其愚蠢的方法来应付的。

Public sub Test1(ParamArray Args())

select case ubound(args)
case -1
call test2()
case 0
call test2(Args(0))
case 1
call test2(Args(0), Args(1)
case 2
call test2(Args(0), Args(1), Args(2))
case 3
call test2(Args(0), Args(1), Args(2), Args(3))
case 4
call test2(Args(0), Args(1), Args(2), Args(3), Args(4))
.
.
.
.
.
.

end select
End sub


哎!苦命的我!
foolishidea 2002-10-08
  • 打赏
  • 举报
回复
现在要在Test1中调用Test2,并把Test1的参数Args传到Test2中去。
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~

注意:Test2不能改动,Test1怎么改都行。

谢谢!
xwyou 2002-10-08
  • 打赏
  • 举报
回复
'//Try it!
Public sub Test1(ParamArray Args() As Variant)
call test2()'???????????参数怎么写
End sub

'//The array declared by the ParamArray keyword can only be of
'//the Variant type.
foolishidea 2002-10-08
  • 打赏
  • 举报
回复
看看MSDN中Function的用法,有讲ParamArray关键字的。
foolishidea 2002-10-08
  • 打赏
  • 举报
回复
come on......
holydiablo 2002-10-08
  • 打赏
  • 举报
回复
你的语法我看不太懂
foolishidea 2002-10-08
  • 打赏
  • 举报
回复
动态参数数组不可以加Byval
EpopeeLei 2002-10-08
  • 打赏
  • 举报
回复
哦,好像明白了,前面我说的没错,将Test2改成:
public sub test2(Byval ParamArray Args())

End sub
EpopeeLei 2002-10-08
  • 打赏
  • 举报
回复
什么意思不太明白,在参数前加个Byval看行不行。
holydiablo 2002-10-08
  • 打赏
  • 举报
回复
你这个ParamArray是个什么东西啊,Args动态数组???

7,763

社区成员

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

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