vb2005 + -1 Dimensional String错误 [英] vb2005 + -1 Dimensional String error

查看:79
本文介绍了vb2005 + -1 Dimensional String错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我对VB2005很陌生我只是在一个项目上工作,出现问题让我很沮丧。


Dim searchThese(1)As String

myvar(0)=" Hi"

myvar(1)=" Bye"


searchfolder(myvar as string)


定义上面的数组后我正在制作这样的函数:


函数SearchFolder(ByVal myvar As String())

//这里的代码

结束函数


当我运行以上内容时我会收到错误说''的值''-1字符串的数组''无法转换为字符串'


i我真的很困惑为什么会发生这种情况以及如何解决这个问题任何帮助非常感谢。


关心

Hi,

I pretty new to VB2005 i was just working on a project a problem arise which really got me frustrated.

Dim searchThese(1) As String
myvar(0) = "Hi"
myvar(1) = "Bye"

searchfolder(myvar as string)

after defining the above array i was making a function like this:

Function SearchFolder(ByVal myvar As String())
// code here
End Function

when i run the above could i get an error saying "Value of ''-1 Dimensional array of string'' cannot be converted to string"

i am really confused on why this is happening and how i can resolve this problem any help would be highly appreciated.

Regards

推荐答案

凹凸:(


任何帮助请:(
Bump :(

Any help please :(


strin g [] ss = new string [1];

//这里的大小是1;所以你只能有ss [0]而不是ss [1];

表示该字符串[] ss = new string [2];
string[] ss=new string[1];
// here the size is one ; so you can only have ss[0] and not ss[1];
for that string[] ss=new string[2];


你好,


感谢您的回复DirtBag :)


对不起:(但我仍然无法理解:(抱歉n00b在这里:)


我开始使用数组作为

dim var as string(1)


所以这意味着我只有有一个索引?


我不太确定,在vb.net中数组的索引是从0还是1开始?


你能指出我如何修复我提供的代码:(


提前谢谢)

问候
Hello,

Thanks for your response DirtBag :)

i''m sorry :( but i still cant understand :( sorry n00b here :)

I started an array as
dim var as string(1)

so does that mean i only have one index?

i''m not quite sure, does the index of an array start from 0 or 1 in vb.net?

could you point out exactly how i can fix my code that presented :(

Thanks in advance :)
Regards


这篇关于vb2005 + -1 Dimensional String错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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