Home All Groups Group Topic Archive Search About

Opening a browser from vb.net from

Author
5 Apr 2005 12:31 PM
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

--
Message posted via http://www.dotnetmonster.com

Author
5 Apr 2005 12:37 PM
Cor Ligthert
Vigneshwaran,

Default browser
\\\
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.FileName = "http://www.google.com"
p.StartInfo = pi
p.Start()
///
Author
5 Apr 2005 1:00 PM
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

--
Message posted via http://www.dotnetmonster.com
Author
5 Apr 2005 1:41 PM
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
Author
5 Apr 2005 2:18 PM
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

--
Message posted via http://www.dotnetmonster.com
Author
5 Apr 2005 2:47 PM
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
Author
5 Apr 2005 3:10 PM
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

--
Message posted via http://www.dotnetmonster.com
Author
5 Apr 2005 3:32 PM
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
Author
5 Apr 2005 3:49 PM
Herfried K. Wagner [MVP]
"Vigneshwaran G via DotNetMonster.com" <fo***@DotNetMonster.com> schrieb:
>   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>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>