Results 1 to 7 of 7

Thread: Help with ByVal as Token

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Location
    South Africa
    Posts
    400

    Help with ByVal as Token

    Hi All

    A strange one here that I haven't encountered before, I have to integrate to a third party application. Everything has gone swimmingly until I found a sub with a ByVal as token, I get a type mismatch whenever I try and pass data to it.

    Code:
        Public Sub TestCode(ByVal Code As token)
            'blah blah blah'
        End Sub
    So when I pass data from my VB6 app like TestCode (1234567), it always generates a type mismatch error no matter what I do. All the other subs that are strings, integers or longs all work spot on except this token one. Does anyone have any ideas ?

    Many thanks
    AJ.

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Help with ByVal as Token

    Well what is Token? That is not a VB data type so I assume it must be a UDT or a Class you are passing a literal number and apparently it is not compatible with whatever Token is hence the mismatch.

    Search your project for Token and see where it is defined and as what.

  3. #3
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Help with ByVal as Token

    Well since this is calling a thrid-party function, I doubt searchying the source code will help. But what should is reading the documentation ... find out what "token" is ... clearly it's an object of some kind. Whther it is a structure/UDT or a class makes a difference, albeit small. But likely you need to Dim something as Token ... then after setting the fields/properties of something to their proper values, you can pass something to the method.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Help with ByVal as Token

    I somehow missed the 3rd party reference so yes it probably is not in the project code, may be able to see it in the object browser or buy dimming some as token like suggested above.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Location
    South Africa
    Posts
    400

    Re: Help with ByVal as Token

    Hi All

    The documentation unfortunately isn't very helpful, the Token is supposed to be a 6 - 12 digit OTP and that's about all the information I can extrapolate from their masterpiece reference document. The function i need to call of theirs is declared as token, so even if i try and declare my own variables as something else it still doesn't work as i am connecting to an external service and token gets recognized.

  6. #6
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Help with ByVal as Token

    Right... because you need a variable defined as type "Token" ... what ever the heck that is... so delcaring it as something else isn't going to work. It's like taking an orange and trying to pass it to the Marinara method that's expecting a Tomato... might look similar (round & a fruit & with a skin) but it's still not a Tomato ...

    And as a matter of pedantry and semantics, Token is not supposed to be a 6-12 digit OTP ... Token is a TYPE... Code maybe a 6-12 digit OTP (what ever OTP means) ... but you still need a variable that has been typed as Token to pass the information over.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Help with ByVal as Token

    If a TOKEN type is defined in the 3rd party source, then you should be able to declare a variable as type token, i.e., Dim myToken As Token. This was suggested above. Also suggested is to look at your object browser (F2). Type Token in the search window & see what you get
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width