By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
461,955 Members | 730 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 461,955 IT Pros & Developers. It's quick & easy.

WebBroswer Control Problem (Simple 2 lines of code!)

P: 1

I am having a very weird problem that I cant find any solution on the Internet (after so many years!). I am trying to code a C# program and I am using the WebBroswer control.

The code is very simple. 1 button and 1 webbroswer control. When the button is clicked I want it to navigate to

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  10. namespace WindowsFormsApplication1
  11. {
  12.     public partial class Form1 : Form
  13.     {
  14.         public Form1()
  15.         {
  16.             InitializeComponent();
  17.         }
  19.         private void button1_Click(object sender, EventArgs e)
  20.         {
  21.             // This works!
  22.             //webBrowser1.Navigate("");
  24.             // This generates "vshost has stopped working"
  25.             webBrowser1.Navigate("");
  27.         }
  30.     }
  31. }
When the loads it generates an error saying "vshost has stopped working" and the application closes. Note that this happens 95% of the time. For some reason some times it works!?!

If however i try it works 100%.

Now for the strange part. Using the second version of the application that works (i.e. webBrowser1.Navigate(""); ) I search for ebay using google and I manually navigate to (meaning I am clicking on the search results link). IT WORKS 100% !

If anyone can help me I would be grateful. I cant find any other info on this problem. Thank you for reading
Apr 7 '08 #1
Share this Question
Share on Google+
2 Replies

P: 36
Sure ??

becoz iam using this and its open successfully, may be there will be other issue, if know then share with us
Apr 8 '08 #2

Expert 5K+
P: 7,872
vshost is only used durring debugging sessions.
Apr 8 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.