Opening a browser from vb.net from

  • Thread starter Vigneshwaran G via DotNetMonster.com
  • Start date
V

Vigneshwaran G via DotNetMonster.com

Hi ,
I am in need of opening a new IE browser with an URL from my windows
form, coded in vb.net.
I tried with the following code.
Dim psi As New ProcessStartInfo
psi.FileName = "iexplore"
psi.Arguments = "http://www.google.com"
Process.Start(psi)

it worked initially. But now I recieve the error
"The application failed to initialize properly (0xc000007b)."
It works for anyother appication like notepad, mspaint, winword etc...
but shows error for iexplore alone!

Please help me in achieving this...


Regards
Vignesh
 
V

Vigneshwaran G via DotNetMonster.com

Hi Cor,
Thanks for ur response again.

I tried as u said, But still recieving the following error

An unhandled exception of type 'System.ComponentModel.Win32Exception'
occurred in system.dll

Additional information: The system cannot find the file specified

Any suggestions please?

Thanks,
Vignesh
 
C

Cor Ligthert

Vignashwaran,

I tried it on a new form, it shows a browser with a Google page.

Therefore, why not try it in a new project.

cor
 
V

Vigneshwaran G via DotNetMonster.com

Thanks Cor,
It worked for me too in a new project!
But what I need is to add a button in a form of an existing application
cliking which a new browser should start with a given URL.

Any suggessions for this scenario please...

Regards
Vignesh
 
C

Cor Ligthert

Vignesh,

This is standard, put a button on your form, click on that there will be a
buttonclick event created and in that you place this code.

I have the idea that I miss something from the problem

Cor
 
V

Vigneshwaran G via DotNetMonster.com

Hi Cor,
Thats where iam getting error.
If i write the same code in the button click event, iam getting the error
that i mentioned so far...

Thanks,
Vignesh
 
C

Cor Ligthert

Vignesh,

Like this,
\\\
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.FileName = "http://www.google.com"
p.StartInfo = pi
p.Start()
End Sub
///
This I cutted from a program that I tried, therefore you understand probably
already that it showed a browser.

I hope this helps,
Cor
 
H

Herfried K. Wagner [MVP]

Vigneshwaran G via DotNetMonster.com said:
I am in need of opening a new IE browser with an URL from my windows
form, coded in vb.net.
I tried with the following code.
Dim psi As New ProcessStartInfo
psi.FileName = "iexplore"
psi.Arguments = "http://www.google.com"
Process.Start(psi)

it worked initially. But now I recieve the error
"The application failed to initialize properly (0xc000007b)."
It works for anyother appication like notepad, mspaint, winword etc...
but shows error for iexplore alone!

Any reason for opening the file in IE explicitly? If there is no certain
reason for doing that, I'd let the OS pick the default browser to open the
document:

Opening files, applications, Web documents, and the mail client
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=openfileappwebpage&lang=en>
 

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