Launching IE from a Forms App

G

Guest

Hi,

I'm building a Windows Forms application that parses a variety of web pages.
The web page structure generally includes a search page with form fields and
a "submit" button, and clicking submit loads the results page we're
interested in parsing.

Thanks to some help from here and the MSDN library, I've got the actual
parser working great. I parse the search page for form fields, then create a
WebRequest and write a RequestStream with all the form variables, then I
retrieve a ResponseStream with all the data I need.

Now we've decided it would be nice to give users the option to display the
results page in the web browser, both to confirm the data and because there
are links to other resources on the results page.

I tried just dumping the text into a temp file, but the graphics, styles and
relative links don't come out right. What I would like to do is launch the
web browser and go to the actual results page.

What I need to know is...

1. How do I launch the web browser and go to a specific URI from within a
Windows Forms application?

2. How can I post form data as part of the request?

Thanks,
Adam

USING: VB.NET, Framework 1.1
 
C

Cathal Connolly [VB MVP]

You can just start it as a normal process, and then use the -new
commandswitch to open the site e.g

Imports System.Diagnostics

Dim pIE As New ProcessStartInfo()
With pIE
.FileName = "iexplore"
.Arguments = "-new http://www.mysite.com/"
End With
Process.Start(pIE)

Alternatively, you can embed a browser control in your winforms app. This
article gives examples for both 1.1 and 2.0
http://www.c-sharpcorner.com/Code/2004/Sept/WebBrowserControl.asp

Cathal
 
G

Guest

Thanks... I ended up going with the SHDocVw.InternetExplorer object because I
needed to post form data along with my request. After some long searching, I
discovered how the PostData parameter of the Navigate method worked, and now
it's working great.

Thanks for your help.

Adam
 

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

Top