axWebBrowser

I have this problem in vusal j#,
C:\Work\Form1.jsl(92): Cannot find method 'Navigate(String)' in 'AxSHDocVw.AxWebBrowser'
I have no clue how to fix this, the program works on my friends comp but not mine, I'm running win xp sp2 with zone alarm security suite installed.
Please reply
-- Thanks
[317 byte] By [eNc] at [2008-1-27]
# 1
Hi,
I feel you are missing the reference to the required assemblies on your system. To compile this code you need to refer following two assemblies
1. SHDocVw.dll
2. AxSHDocVw.dll

Above two assemblies need to be generated form shdocvw.dll, which is a com dll. You can issue following command from Visual studio command prompt to generate the dlls...

aximp d:\windows\system32\shdocvw.dll

Please correct the path for shdocvw.dll as per your system settings.
To know more about aximp, please refer to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpgrfWindowsFormsActiveXControlImporterAximpexe.asp.

Please let us know if it doesn't help.

Thanks.

JaiprakashSharma at 2007-9-8 > top of Msdn Tech,Visual J#,Visual J# General...
# 2
Ok, so what I did was open cmd, and I typed

cd C:\

C:\> aximp c:\windows\system32\shdocvw.dll

but it then tells me " 'aximp' is not recognized as an internal or external command, " so it doesn't work, Is there a way that I can generate assemblies in Visual Studio or something like that, and am I doing my console commands right, all I did was open it and write that.

- Please reply

eNc at 2007-9-8 > top of Msdn Tech,Visual J#,Visual J# General...
# 3
Hi,
You are getting the error because aximp is not in the PATH.

If you are working on J# express, then you need to add the path of aximp to the PATH environment variable. Aximp is shipped with Visual studio sdk and you can find it at
%systemdrive%\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin.
After adding above path to PATH variable, you should not be getting the error.

If you are working on VSTS instead of express then go to Start > Programs > Microsoft Visual Studio 2005 >Visual Studio Tools > Visual Studio 2005 Command prompt. Here you can directly use aximp beause it is already included in the path for this command prompt.

After you have generated the required assemblies, just refer them and build the project. You should be ableto compile successfully.

Please, let us know if u face any problem.

Thanks,
Jaiprakash

JaiprakashSharma at 2007-9-8 > top of Msdn Tech,Visual J#,Visual J# General...
# 4
Ok, well I have version 2003 installed and I did it using cd to get to the dir which I search AxImp.exe for. C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin>AxImp C:\windows\system32\shdocvw.dl
l
Generated Assembly: C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin\SHDocVw.dll
Generated Assembly: C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin\AxSHDocVw.dll

It worked!!! yay!!
Ok should I restart my system ? I tried to use the navigate method in VS it still gives me that error
Plz Reply

eNc at 2007-9-8 > top of Msdn Tech,Visual J#,Visual J# General...
# 5
I re-booted, it still doesn't work, Maybe its the generated assembly file itself ?, I drag my microsoft web browser component onto my form, right click, click view code, then I return to the graphical view, double click it, and type browser.Navigate("http://www.google.ca/"); browser is the name of my ms web browser component. Am I doing somthing wrong ?
Please Reply
eNc at 2007-9-8 > top of Msdn Tech,Visual J#,Visual J# General...
# 6
Hi,
No, you need not reboot your machine. It must work if boht the assemblies are being refered in your project. Can you please try following...

1. Make sure that both the assemblies are being referenced in your project.
2. When you type browser. in the editor, does the intellisense shows the "navigate" method there.
3. Can you tell me the fileversion of C:\windows\system32\shdocvw.dl. That you can check by right clicking on the dll > Properties > Version > File Version. I have got 6.00.2800.1622 (xpsp2.050218-1437) on may machine and it works perfectly fine for me.

BTW, i feel this issue is a common issue to all the langs. If you follow the same steps in a C#/VB project then too you should hit the same issue.

Thanks

JaiprakashSharma at 2007-9-8 > top of Msdn Tech,Visual J#,Visual J# General...
# 7
Here's my file version for the shdocvw.dll 6.0.2900.2627 and I'm running xpsp2, but I don't know what version it is. And I'm not sure what you mean by both the assemblies are being referenced to in my project, however when I type browser. intellisense shows a "navigate" method in the list of other methods to use with the browser. Also I'm my project I look under referenced and it shows that the AxSHDocvW is referenced, and in the bin file in my program directory, there are the genereated files from the aximp.

Is the problem my dll version maybe ?
Please Reply

eNc at 2007-9-8 > top of Msdn Tech,Visual J#,Visual J# General...
# 8
Hi,
From "By both the assemblies are being referenced to in your project" i meant that can you see both the assemblies generated by aximp in the solution explorere under references folder. But i believe they are there because you are able to see navigate method in intellisense drop down.

Ca you check that how many overlaods of Navigate function are shown on your machine? On my machine, I can see two with following prototypes...

1. public void Navigate ( String uRL , Object flags , Object targetFrameName , Object postData , Object headers )
2. public void Navigate ( String
uRL )

If you are not able to see the second overload then you have got older dlls. You can work around by copying both dlls from the other machine where the code compiles.

If not, then please mail back.

Thanks for your patience.

JaiprakashSharma at 2007-9-8 > top of Msdn Tech,Visual J#,Visual J# General...
# 9
I can see the first method when I type browser. then intellisense pops up and shows the Navigate and the Navigate2 method, but I can only see the public void Navigate ( String uRL , Object flags , Object targetFrameName , Object postData , Object headers ) when I click on the method it shows this at the bottom of the screen (underneath workspace). What .dlls would I require from the other machine to replace mine with?
PS, I'm at school right now so i'll be home in 4 hrs
Please Reply
eNc at 2007-9-8 > top of Msdn Tech,Visual J#,Visual J# General...
# 10
Hi,
Seems you really have got the older version of WINDOWS\system32\SHDOCVW.DLL which doesn't implement the required overlaod of Navigate function, which you are using in your code.

I would suggest you to use following lines of code in you application instead of replacing SHDOCVW.DLL. Replacing this dll may break other applications on your system...

Object obj = null;
axWebBrowser2.Navigate("http://www.msn.com/", obj, obj, obj, obj);


Please note that here we are passing null for rest of the parameters. So this code will work fine until unless you want to do something from your code which depends upon those parameters, which i believe you are not likely to do as you wanted to use the overload which takes only the URL.

Please reply back if your problem is not solved.

Thanks alot !

JaiprakashSharma at 2007-9-8 > top of Msdn Tech,Visual J#,Visual J# General...
# 11
Just to confirm, This is for J# right ? The reason I'm asking is because I saw this solution somewhere else but for C++, and I don't think I will be passing any params into the Method. I'm at school right now I'll be home at 4 est, I'll see if it works then, I'll get back to you later.
Please Reply
eNc at 2007-9-8 > top of Msdn Tech,Visual J#,Visual J# General...
# 12
Hey thanks it worked! I have another question if you could help me with it, I created a browser and then buttons, one of my buttons is webBrowser.GoForward(); if I click it to many times I get an error, what can I do to prevent this?
Please Reply
Ps- Thanks for your help.
eNc at 2007-9-8 > top of Msdn Tech,Visual J#,Visual J# General...
# 13
Hi,
No, the solution is not specific to J#. Since you have got a older dll, you must get the same compilation error with C# and VB also. The only difference is that you have to follow the respective language syntax.

I didn't get the sentence "but for C++, and I don't think I will be passing any params into the Method". It will be better if you send the piece of c++ code across.

Thanks.

JaiprakashSharma at 2007-9-8 > top of Msdn Tech,Visual J#,Visual J# General...
# 14
I have been trying to do exactly the same thing, however, what you have suggested there, does not work for me.
Anything I could do?
vixxen at 2007-9-8 > top of Msdn Tech,Visual J#,Visual J# General...