very strange ASP / VB dll behavior

M

Michael Bosco

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.
 
A

Alex Kail

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top