very strange ASP / VB dll behavior

Discussion in 'ASP General' started by Michael Bosco, Jul 8, 2004.

  1. Hi. I am fairly new to ASP. I have to build a website in ASP 3 that
    interfaces with VB 6 dll's. I've noticed some strange behavior, so I
    devised the following tests. Here's my test VB 6 function...

    Public Function ReturnGivenBool(blnReturn As Boolean) As Boolean
    ReturnGivenBool = blnReturn
    End Function

    All it does is return the boolean value it receives.

    The following call works, it returns True (I'm logging all this stuff
    in the event viewer)...
    blnIn = true
    objTest.ReturnGivenBool (blnIn)

    Problem #1
    However if I want to print the return to the webpage...

    <% blnIn = true %>
    <%= objTest.ReturnGivenBool (blnIn) %>

    I get the ASP error: "Type mismatch: objTest.ReturnGivenBool". Why
    would it work in one instance but not the other?

    While trying to get around this problem, I discovered...

    objTest.ReturnGivenBool (blnIn) (variable input param, do not save
    return value) works...
    blnReturnCode = objTest.ReturnGivenBool (true) (hardcode input param,
    save return value) also works, but combining them...

    blnReturnCode = objTest.ReturnGivenBool(blnIn) (variable input param
    and save return value) gives me the same type mismatch error I got
    above.

    Does this make sense to anyone?? Any help would be greatly
    appreciated.

    Thanks.
     
    Michael Bosco, Jul 8, 2004
    #1
    1. Advertising

  2. Michael Bosco

    Alex Kail Guest

    Wrap a CBool around the blnIn variable, like this...

    <% blnIn = true %>
    <%= objTest.ReturnGivenBool (CBool(blnIn)) %>

    Remember, everything is a variant in ASP. ReturnGivenBool expects a
    boolean variable, even though you are setting blnIn = True, it is
    still a variant, until you use CBool, which will push it in as a
    boolean.

    I hope this helps.
    Alex Kail
     
    Alex Kail, Jul 14, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Raymond Arthur St. Marie II of III

    very Very VERY dumb Question About The new Set( ) 's

    Raymond Arthur St. Marie II of III, Jul 23, 2003, in forum: Python
    Replies:
    4
    Views:
    484
    Raymond Hettinger
    Jul 27, 2003
  2. shanx__=|;-

    very very very long integer

    shanx__=|;-, Oct 16, 2004, in forum: C Programming
    Replies:
    19
    Views:
    1,633
    Merrill & Michele
    Oct 19, 2004
  3. Abhishek Jha

    very very very long integer

    Abhishek Jha, Oct 16, 2004, in forum: C Programming
    Replies:
    4
    Views:
    428
    jacob navia
    Oct 17, 2004
  4. Peter

    Very very very basic question

    Peter, Feb 8, 2005, in forum: C Programming
    Replies:
    14
    Views:
    520
    Dave Thompson
    Feb 14, 2005
  5. olivier.melcher

    Help running a very very very simple code

    olivier.melcher, May 12, 2008, in forum: Java
    Replies:
    8
    Views:
    2,305
Loading...

Share This Page