Passing variant containing byte array 
Author Message
 Passing variant containing byte array

pls help me here.
I just can't get the following codes to work. Type mismatch!!!

dim texte
texte="mystr"
dim x()
dim length
length = len(texte)
redim x(length)
for i=0 to length-1
 x(i) = mid(x, i, 1) 'there is type mismatch here!!!
next
ActiveXObj.Test(x)



Wed, 28 Sep 2005 16:04:53 GMT  
 Passing variant containing byte array
If I understand your problem, maybe this is a solution.

for i=0 to len(texte)-1
  x(i) = mid(texte,i+1,1)
next

Hans Stavleu


Quote:
> pls help me here.
> I just can't get the following codes to work. Type mismatch!!!

> dim texte
> texte="mystr"
> dim x()
> dim length
> length = len(texte)
> redim x(length)
> for i=0 to length-1
>  x(i) = mid(x, i, 1) 'there is type mismatch here!!!
> next
> ActiveXObj.Test(x)



Wed, 28 Sep 2005 18:24:46 GMT  
 Passing variant containing byte array
the error is happening at the line
x(i) = mid(x, i, 1) 'there is type mismatch here!!!
where it complains i in x(i) type mismatch.
if you take this script and run it under IE then you will
notice the error...
Quote:

> If I understand your problem, maybe this is a solution.

> for i=0 to len(texte)-1
>   x(i) = mid(texte,i+1,1)
> next

> Hans Stavleu



> > pls help me here.
> > I just can't get the following codes to work. Type mismatch!!!

> > dim texte
> > texte="mystr"
> > dim x()
> > dim length
> > length = len(texte)
> > redim x(length)
> > for i=0 to length-1
> >  x(i) = mid(x, i, 1) 'there is type mismatch here!!!
> > next
> > ActiveXObj.Test(x)



Wed, 28 Sep 2005 21:10:56 GMT  
 Passing variant containing byte array

Quote:

> pls help me here.
> I just can't get the following codes to work. Type mismatch!!!

> dim texte
> texte="mystr"
> dim x()
> dim length
> length = len(texte)
> redim x(length)
> for i=0 to length-1
>  x(i) = mid(x, i, 1) 'there is type mismatch here!!!
> next
> ActiveXObj.Test(x)

You can't use an array (x)  as the string argument in the Mid statement
(mid(x,i,1)). If I understand what you're trying to do correctly, this
should be the line:
x(i) = mid(texte, i, 1)

HTH,
Bob Barrows



Thu, 29 Sep 2005 00:04:36 GMT  
 Passing variant containing byte array
Quote:

> the error is happening at the line
> x(i) = x(i) = mid(x, i, 1) 'there is type mismatch here!!!
> where it complains i in x(i) type mismatch.
> if you take this script and run it under IE then you will
> notice the error...

It's not the "x(i)" that's causing the mismatch: it's the "mid(x, i, 1)"
part. You can't use the array as the string argument here. Mid requires a
string as the firs argument, not an array.

Just to correct my last post, as Hans says, this should be the line:
x(i) = mid(texte,i+1,1)

HTH,
Bob Barrows



Thu, 29 Sep 2005 00:07:42 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. oracle, ado, delphi5

2. Variant containing a Byte Array returned from C++

3. TSR problem

4. Pass variant containing a byte array to activeX from vbscript client!!

5. Variant (array of bytes)

6. extending a variant array with one byte

7. Variant (array of bytes)

8. ODBC & Access 7.0 problems

9. Update typed file

10. online delphi college course - acredited

11. Delphi (3 standard) and mysql databases on unix

12. Returning Variants That Contains an Array to JScript

 

 
Powered by phpBB® Forum Software