Activate WebBrowser

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2009
Posts: 9
Reputation: dave starkey is an unknown quantity at this point 
Solved Threads: 0
dave starkey dave starkey is offline Offline
Newbie Poster

Activate WebBrowser

 
0
  #1
Sep 18th, 2009
Dear All,
I have dropped a WebBrowser control onto my form but It will not display the webpage I have set the code to navigate to. Snippet is - APBrowsePage.Navigate("http://www.microsoft.com"); .
Where APBrowsePage is the control name.

Dave
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Activate WebBrowser

 
0
  #2
Sep 18th, 2009
  1. webBrowser1.Url = new Uri("http://microsoft.com");
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: Activate WebBrowser

 
0
  #3
Sep 18th, 2009
Zip your project and upload it. You can do this by clicking "Go Advanced" next to "Post Quick Reply", and in the next screen click on manage attachments.
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 9
Reputation: dave starkey is an unknown quantity at this point 
Solved Threads: 0
dave starkey dave starkey is offline Offline
Newbie Poster

Re: Activate WebBrowser

 
0
  #4
Sep 18th, 2009
Ramy,
I have already tried to convert the URL to URI but that doesnt work either. Scott - The project should be attached - not sure what you needed so I put everything in.

Thanks
Dave
Attached Files
File Type: zip IPSetv3.zip (65.8 KB, 0 views)
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Activate WebBrowser

 
0
  #5
Sep 18th, 2009
It works I tried it
Please tell me what's the compilation error...
Last edited by Ramy Mahrous; Sep 18th, 2009 at 10:10 am.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 9
Reputation: dave starkey is an unknown quantity at this point 
Solved Threads: 0
dave starkey dave starkey is offline Offline
Newbie Poster

Re: Activate WebBrowser

 
0
  #6
Sep 18th, 2009
Ramy,
Theres no error - the control is just blank when I run the exe. Does the line of code need to defined in a particular event that I am not yet handling?

Dave
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Activate WebBrowser

 
0
  #7
Sep 18th, 2009
Yes, you can but it inside button click event handler or set it from control properties
Uri = http://microsoft.com
Believe me it works
Last edited by Ramy Mahrous; Sep 18th, 2009 at 11:13 am.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 9
Reputation: dave starkey is an unknown quantity at this point 
Solved Threads: 0
dave starkey dave starkey is offline Offline
Newbie Poster

Re: Activate WebBrowser

 
0
  #8
Sep 18th, 2009
Oops, I uploaded the wrong files in the last post. Here is the one with the Browser object.

Dave
Attached Files
File Type: zip MainForm.zip (66.9 KB, 3 views)
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: Activate WebBrowser

 
0
  #9
Sep 18th, 2009
In the project you uploaded the only thing I see for the browser is:
  1. void WebBrowser1DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
  2. {
  3. webBrowser1.Url = new Uri("http://microsoft.com");
  4. }

That is in the document complete event but I don't see anywhere that initially tell the navigator to browse. You should not be changing the browser's URL in the complete event because when it finishes loading a page it will call that event, triggering another page load, and it will loop.

I made these changes and it works:
  1. void BrowseFaultyAPClk(object sender, EventArgs e)
  2. {
  3. webBrowser1.Navigate(@"http://www.google.com");
  4. /*
  5.   string FaultyAPAddr = "http://" + FaultyAPIPOct1Num.Value + "."
  6. + FaultyAPIPOct2Num.Value + "."
  7. + FaultyAPIPOct3Num.Value + "."
  8. + FaultyAPIPOct4Num.Value + ".";
  9. Process ProcessIeFaultyAP = new System.Diagnostics.Process();
  10. ProcessIeFaultyAP.StartInfo.FileName = "iexplore.exe";
  11. ProcessIeFaultyAP.StartInfo.WorkingDirectory = @"C:\WINDOWS\ie7";
  12. ProcessIeFaultyAP.StartInfo.Arguments = String.Format(FaultyAPAddr);
  13. ProcessIeFaultyAP.Start();
  14.   */
  15. }
  16.  
  17. void WebBrowser1DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
  18. {
  19. //webBrowser1.Url = new Uri("http://microsoft.com");
  20. }
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 9
Reputation: dave starkey is an unknown quantity at this point 
Solved Threads: 0
dave starkey dave starkey is offline Offline
Newbie Poster

Re: Activate WebBrowser

 
0
  #10
Sep 21st, 2009
Dear All,
Thanks for your help - I've now got it working. I had been using the DocumentCompleted event because this was automatically created when I double clicked on the object.

Dave
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC