我如何......纠正这个错误。 [英] How do I... Rectify this error.

查看:76
本文介绍了我如何......纠正这个错误。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:整数类型的值无法转换为一维数组。



我尝试过:



公共共享函数processSaveAs(optionsTextInfo()As String)作为整数

当我调用上面的函数时它会在processSaveAs(1)给我错误)

 Public Shared Sub Main()
processSaveAs(1)
End Sub

解决方案

是的,它会。

你对函数的定义:

 公共 共享 功能 processSaveAs(optionsTextInfo()作为 字符串作为 整数 

说它是一个传递一个字符串数组的函数,它返回一个整数。

不是它是p assed一个整数并返回别的东西!



你要做的就是将命令行参数传递给方法,这意味着你需要改变定义主要是:

 公共 共享 < span class =code-keyword> Sub  Main( ByVal  args() As  < span class =code-keyword> String )
processSaveAs(args)
结束


Error: Value of type "Integer" cannot be converted to 1-dimensional array.

What I have tried:

Public Shared Function processSaveAs(optionsTextInfo() As String) As Integer
When iam calling the above functio it is giving me error at processSaveAs(1)

Public Shared Sub Main()
            processSaveAs(1)
        End Sub

解决方案

Well yes, it will.
Your definition of the function:

Public Shared Function processSaveAs(optionsTextInfo() As String) As Integer

Says that it is a function which is passed a array of strings, and which returns an integer.
Not that it is passed an integer and returns something else!

Probably what you are trying to do is pass the command line arguments to the method, which means you need to change the definition of Main first:

Public Shared Sub Main(ByVal args() As String)
    processSaveAs(args)
End Sub


这篇关于我如何......纠正这个错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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