Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.NET equivalent of VB6 Internet access 2

Status
Not open for further replies.

PavelGur

Programmer
Sep 21, 2001
75
I have the following code working very well in VB6. I have some trouble to find an equivalent for VB.NET. I looked into WebClient but it does not seem to do the same work.
Does anybody know what it is?
Thanks, Pavel.


Sub IntTest()
Dim oIE As New SHDocVw.InternetExplorer
Dim sURL, sBuffer As String

sURL = "
'open a new, visible IE window
Set oIE = New SHDocVw.InternetExplorer
oIE.Visible = True

'go to desired page - Yahoo in this case
oIE.Navigate sURL

'wait for page to finish loading
Do Until oIE.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

oIE.Document.all("tbxUserName").Value = "MyID"
oIE.Document.all("tbxPWD").Value = "MyPSWD"
oIE.Document.all("btnLogin").Click
'oIE.Document.Forms(0).submit
Do Until oIE.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

sBuffer = oIE.Document.Body.innertext

End Sub
 
I am not sure if you actually want to do it this way, but you can add a reference to the Microsoft web broweser COM control into your .NET project. If you do this you have to set the projects properties to allow for COM interop.

Anyway if you want to use the Microsft web browser control, right click on the toolbox and select add/remove items. A dialog box will be dispalyed that allows you to add .NET or COM components.

Click on the COM tab and scroll down to the Microsoft web browser control and select it.

If you do this wou wil also need to distibute the dll files Interop.shdocvw.dll and Axinter.shdocvw.dll

HTH
 
Thanks for reply newora. I'm not sure whether I want to do it this way too. What are pro's and con's? It seems to be considerably more complicated than VB6 code that works very well. I'm just trying to move to .NET and so far I found that it is not always beneficial.
Thanks again, Pavel.
 
if you use 2002 or 2003 then the vb6 code will still work you just need to set the reference to the axwebbrowser.

if you have 2005 then you can use the webbrowser control wich is part of the controlset.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
Thanks chrissie!
I have 2002 version. I tried to add axwebbrowser. But I did not find it in .NET tab. I found axbrowse in COM tab and added it. But it did not resolve the problem. It still does not recognize
sBuffer = myClient.OpenRead(sURL)
Am I missing something?
Thanks again, Pavel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top