3 Replies - 688 Views - Last Post: 08 April 2013 - 07:37 PM Rate Topic: -----

#1 marvinmartian  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 36
  • Joined: 07-October 09

data type error passing a byte into a variant

Posted 03 April 2013 - 06:51 PM

here's my declaration:

Const DATASIZE = (1404 + 12) / 4
dim glngEnrollData as variant
dim vByte() as byte
dim vstr as string

If vFingerNumber < 10 Then
                    vStr = !FPdata
                    vByte = vStr
                    For I = 0 To DATASIZE - 1
type mismatch here--->> glngEnrollData(I) = vByte(I * 5 + 1)
                        glngEnrollData(I) = glngEnrollData(I) * 256 + vByte(I * 5 + 2)
                        glngEnrollData(I) = glngEnrollData(I) * 256 + vByte(I * 5 + 3)
                        glngEnrollData(I) = glngEnrollData(I) * 256 + vByte(I * 5 + 4)
                        If vByte(I * 5) = 0 Then
                            glngEnrollData(I) = 0 - glngEnrollData(I)
                        End If
                    Next
                End If



Is This A Good Question/Topic? 1
  • +

Replies To: data type error passing a byte into a variant

#2 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 572
  • View blog
  • Posts: 2,985
  • Joined: 19-May 09

Re: data type error passing a byte into a variant

Posted 06 April 2013 - 10:30 AM

You've declared glngEnrollData as a single variable, and are trying to use it as an array. That'll give you a type mismatch every time. Even if it's a variant. :)

By the way, I upvoted your post because:

1. You used code tags.
2. You posted all the relevant code.
3. You didn't post 142 lines of irrelevant code.
4. You told us what error you were getting.
5. You told us the description, not the number.
6. You told us what line the error was on.

Thank you!

This post has been edited by BobRodes: 06 April 2013 - 10:36 AM

Was This Post Helpful? 0
  • +
  • -

#3 marvinmartian  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 36
  • Joined: 07-October 09

Re: data type error passing a byte into a variant

Posted 07 April 2013 - 11:53 PM

View PostBobRodes, on 06 April 2013 - 10:30 AM, said:

You've declared glngEnrollData as a single variable, and are trying to use it as an array. That'll give you a type mismatch every time. Even if it's a variant. :)/>

By the way, I upvoted your post because:

1. You used code tags.
2. You posted all the relevant code.
3. You didn't post 142 lines of irrelevant code.
4. You told us what error you were getting.
5. You told us the description, not the number.
6. You told us what line the error was on.

Thank you!



Thanks Bob, i've got the solution, hope you could continue to support newbie programmers like me, many thanks :-)
Was This Post Helpful? 0
  • +
  • -

#4 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 572
  • View blog
  • Posts: 2,985
  • Joined: 19-May 09

Re: data type error passing a byte into a variant

Posted 08 April 2013 - 07:37 PM

You're welcome.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1