By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,190 Members | 1,653 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,190 IT Pros & Developers. It's quick & easy.

very strange ASP / VB dll behavior

P: n/a
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.
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.