# 变数宣告和函数(程序)引数的问题

Posted by 林文国 on November 27, 1997 at 19:32:48:

If we define two variables in vb6.0 as follows

dim vara(),varb() as byte 'other types also introduce same problem

and there are one function or procedure which defined as
public sub sub_a(...,vara() as byte,varb() as byte,...)
end sub

My problem is that after i call the function or procedure (for example, call sub_a(...,vera,verb,...)) why the compiler tell me the error message, "type mismtach: array or user-defined type expected", in the location of vara(). But, the problem can be sloved by the following defintion
dim vara() as byte
dim varb() as byte

For one words,
1. dim vara(), varb() as byte
2. public sub sub_a(...,vera() as byte ,verb() as byte,...)
3. call sub_a(...,vera,verb,...)
will get an error message, but
1. dim vera() as byte: dim verb() as byte
2. public sub sub_a(...,vera() as byte ,verb() as byte,...)
3. call sub_a(...,vera,verb,...)
will work!!

Can anyone tell me why is the problem happened?

Thank you in advance

Wen-Gou Lin

Follow Ups:

- 宣告方式错误 小吴 20:18:12 11/27/97 (0)