String literal works where string variable with identical value fails??!!

String literal works where string variable with identical value fails??!!

Post by Joseph Ger » Wed, 15 Dec 2004 13:32:12


This is perhaps one of the most bizarre things I've seen in my career as a
VB developer. It's very simple.

The following navigation statement was failing on us on a particular
workstation (we've only seen this on one workstation so far out of
hundreds - XP Pro SP2 - of course :-\ )

wbViewer.Navigate2 m_Document

vbViewer is a Browser control embedded in our own OCX. m_Document is a
module level private variable typed as String. Its value at the time was
'about:blank' (quotes excluded). We generated debug output showing the
Len(m_Document) - exactly 11 characters. However, this was failing on us
with 'Invalid procedure call or argument'

We were desperate, because we have other places in the code where this works
properly, even on the problem workstation. The only difference in those
other statements was that 'about:blank' was coded as a literal rather than
as a string variable. (This is where we initialize our user control.)

wbViewer.Navigate2 "about:blank"

So here's what we did in sheer desperation:

If m_Document = "about:blank" Then
wbViewer.Navigate2 "about:blank"
Else
wbViewer.Navigate2 m_Document
End If

And now the program is working fine once again! But I'm not happy about this
because it just doesn't make any sense! There's something very wrong here
and I'm left waiting for the other shoe to drop...

Can you offer any insight into what might be going on here?

Thanks for your help!

Joe Geretz
 
 
 

String literal works where string variable with identical value fails??!!

Post by Randy Birc » Wed, 15 Dec 2004 14:29:02

Do you possibly have another variable or procedure *somewhere* called
m_Document? As I mentioned in response to your earlier post, I can't
duplicate that here using XP and SP2.

--


Randy Birch
MS MVP Visual Basic
http://www.yqcomputer.com/




: This is perhaps one of the most bizarre things I've seen in my career as a
: VB developer. It's very simple.
:
: The following navigation statement was failing on us on a particular
: workstation (we've only seen this on one workstation so far out of
: hundreds - XP Pro SP2 - of course :-\ )
:
: wbViewer.Navigate2 m_Document
:
: vbViewer is a Browser control embedded in our own OCX. m_Document is a
: module level private variable typed as String. Its value at the time was
: 'about:blank' (quotes excluded). We generated debug output showing the
: Len(m_Document) - exactly 11 characters. However, this was failing on us
: with 'Invalid procedure call or argument'
:
: We were desperate, because we have other places in the code where this
works
: properly, even on the problem workstation. The only difference in those
: other statements was that 'about:blank' was coded as a literal rather than
: as a string variable. (This is where we initialize our user control.)
:
: wbViewer.Navigate2 "about:blank"
:
: So here's what we did in sheer desperation:
:
: If m_Document = "about:blank" Then
: wbViewer.Navigate2 "about:blank"
: Else
: wbViewer.Navigate2 m_Document
: End If
:
: And now the program is working fine once again! But I'm not happy about
this
: because it just doesn't make any sense! There's something very wrong here
: and I'm left waiting for the other shoe to drop...
:
: Can you offer any insight into what might be going on here?
:
: Thanks for your help!
:
: Joe Geretz
:
:

 
 
 

String literal works where string variable with identical value fails??!!

Post by Unicor » Wed, 15 Dec 2004 16:06:08

Joseph,
Is it possible, that the m_Document variable is NOT of type string?
Perhaps there is some weird type conversion happening here that has
something to do with regional setting You could also try trim(m_Document ).
I have seen weird problems go away when leading blanks are trimmed.

Matt
 
 
 

String literal works where string variable with identical value fails??!!

Post by Joseph Ger » Thu, 16 Dec 2004 00:08:12

Hi Randy,

No, that's definitely the only m_Document in scope. I searched the entire
project.

My earlier post? I don't recall posting earlier on the subject but if you
replied earlier to a similar problem I'd like to take a look at that thread.

Thanks,

- Joe Geretz -
 
 
 

String literal works where string variable with identical value fails??!!

Post by Ken Halte » Thu, 16 Dec 2004 00:20:00


Try....

Also, is there any chance you're running McAfee 8.0? *Major* problems with
that release that causes all kinds of things to go wrong. The captions of
labels disappear, Textboxes are cleared, who knows what else. Thx McAfee for
creating the worst virus yet.

--
Ken Halter - MS-MVP-VB - http://www.yqcomputer.com/
Please keep all discussions in the groups..
 
 
 

String literal works where string variable with identical value fails??!!

Post by Bob O`Bo » Thu, 16 Dec 2004 02:32:00


If it's something like that, perhaps it's as simple as

Dim m_Document, m_SomethingElse As String



Bob
 
 
 

String literal works where string variable with identical value fails??!!

Post by Randy Birc » Thu, 16 Dec 2004 08:24:18

: Also, is there any chance you're running McAfee 8.0? *Major* problems with
: that release that causes all kinds of things to go wrong. The captions of
: labels disappear, Textboxes are cleared, who knows what else. Thx McAfee
for
: creating the worst virus yet.

Hi Ken ...

I run 8 and have none of those problems (?).

--


Randy Birch
MS MVP Visual Basic
http://www.yqcomputer.com/
 
 
 

String literal works where string variable with identical value fails??!!

Post by Bob Butle » Thu, 16 Dec 2004 11:12:16


same here
 
 
 

String literal works where string variable with identical value fails??!!

Post by Joseph Ger » Thu, 16 Dec 2004 14:16:53


Dim m_Document As String

It better be a string or we're all in a lot of trouble!

- Joe Geretz -
 
 
 

String literal works where string variable with identical value fails??!!

Post by Mikko Noro » Thu, 16 Dec 2004 20:44:41

Hi,

Where is the value of m_Document set? If it is set in an external COM
component, perhaps it is not handling C to VB conversions properly? Or
releases memory when it shouldn't?

Mikko Noromaa ( XXXX@XXXXX.COM )
- SQL in Excel, check out ExcelSQL! - see http://www.yqcomputer.com/ -
 
 
 

String literal works where string variable with identical value fails??!!

Post by Ken Halte » Fri, 17 Dec 2004 00:52:51


You guys should know that things like this never happen on the Dev PC...
only on a customer's PC when there's no time to investigate what's going on!
;-)

Anyway, that bug's hit me a couple of times. Since I've never had McAfee on
a PC I owned, I was completely stumped and ended up giving refunds to at
least 3 people. Missing text in text boxes, missing captions on labels,
missing text in MsgBox's... It seems that it's due to McAfee 8's buffer
overflow protection.

Here's a couple from the .Net groups.

Subject: empty text boxs and McAfee AntiVirus 8.0i (fixed)
http://www.yqcomputer.com/ %40TK2MSFTNGP12.phx.gbl

Subject: messagebox bug
http://www.yqcomputer.com/ %23uiVXnAzEHA.2788%40TK2MSFTNGP15.phx.gbl#link1


--
Ken Halter - MS-MVP-VB - http://www.yqcomputer.com/
Please keep all discussions in the groups..
 
 
 

String literal works where string variable with identical value fails??!!

Post by Randy Birc » Fri, 17 Dec 2004 11:58:55

Hi Ken ..

Interesting. Must really be a .net thing then, which therefore renders me
immune. :-)

--


Randy Birch
MS MVP Visual Basic
http://www.yqcomputer.com/








: >>
: >> Hi Ken ...
: >>
: >> I run 8 and have none of those problems (?).
: >
: > same here
: >
:
: You guys should know that things like this never happen on the Dev PC...
: only on a customer's PC when there's no time to investigate what's going
on!
: ;-)
:
: Anyway, that bug's hit me a couple of times. Since I've never had McAfee
on
: a PC I owned, I was completely stumped and ended up giving refunds to at
: least 3 people. Missing text in text boxes, missing captions on labels,
: missing text in MsgBox's... It seems that it's due to McAfee 8's buffer
: overflow protection.
:
: Here's a couple from the .Net groups.
:
: Subject: empty text boxs and McAfee AntiVirus 8.0i (fixed)
:
http://www.yqcomputer.com/ %40TK2MSFTNGP12.phx.gbl
:
: Subject: messagebox bug
:
http://www.yqcomputer.com/ %23uiVXnAzEHA.2788%40TK2MSFTNGP15.phx.gbl#link1
:
:
: --
: Ken Halter - MS-MVP-VB - http://www.yqcomputer.com/
: Please keep all discussions in the groups..
:
:
 
 
 

String literal works where string variable with identical value fails??!!

Post by Bjn Holmgr » Fri, 17 Dec 2004 23:21:01


works
this

Although it specifically relates to IE 5.5 SP2, this could be worth a try.

The following MSKB article suggests using variants instead of strings when
calling the Navigate2 method.

PRB: You Receive "Run-Time Error 5" When You Call the Navigate2 Method of
the WebBrowser Control
http://www.yqcomputer.com/ ;en-us;279668
 
 
 

String literal works where string variable with identical value fails??!!

Post by Joseph Ger » Sat, 25 Dec 2004 12:31:29

Thanks Bjorn!

That was exactly our problem.

- Joe Geretz -







a
than
here