ByRef 参数类型不匹配"错误 VB6 [英] ByRef Argument Type Mismatch" Error VB6

查看:27
本文介绍了ByRef 参数类型不匹配"错误 VB6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 VB6 和传播的新手.我的 VB 项目正在使用传播.在传播初始化完成的表单中,VB 6 抛出一个编译错误,如通过引用参数类型不匹配"错误.这是因为的传播问题?我正在从现有的 vb 项目中删除一些功能所以是因为我可能已经注释掉了一些功能.请提供您宝贵的建议.提前致谢.我正在 Windows 7 中运行该应用程序

I am new to VB6 and spread.My VB project is making using of spread .In forms wherever the spread initialization is done,VB 6 is throwing a compile error as "By Ref Argument Type Mismatch" Error" .Is it because of the spread issue? I am removing some functionality from a already existing vb project So is it because i might have commented out some functionality. Kindly.Kindly provide your valuable suggestion.Thanks in advance.I am running the application in windows 7

推荐答案

当您将参数传递给使用 ByRef(默认值)的函数时,会出现ByRef Argument Type Mismatch"错误并且数据类型与预期不符.

The "ByRef Argument Type Mismatch" error occurs when you are passing a parameter to a function that is using ByRef (the default) and the data type does not match what is expected.

Private Sub MyMethod(ByRef Value As String)
  ...
End Sub

Private Sub OtherMethod()
  Dim Value As Integer
  MyMethod Value
End Sub

请注意,Value 声明为 Integer,但参数声明为 String,因此不匹配.

Note that Value is declared as Integer but the parameter is declared as String, and as such are a mismatched.

要么更正数据类型以匹配(哪种方式取决于它们是什么和它们的用途),将参数更改为 ByVal,或者两者都做(最好的选择,除非您明确想使用 ByRef).

Either correct the data types to match (Which way depends on what they are and their use), change the parameter to ByVal, or do both (the best option unless you explicitly want to use ByRef).

如果调用代码不是您的,则可能省略了 By... 导致 ByRef 的 VB6 默认值,即使它不是故意的.

If the calling code is not yours, then it's possible that the By... was ommited resulting in the VB6 default of ByRef even if it wasn't deliberate.

这篇关于ByRef 参数类型不匹配"错误 VB6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆