Click here to Skip to main content
12,348,594 members (70,194 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB VB.NET
WebBrowser1.Navigate("http://www.google.com.br")
       WebBrowser2.Navigate("http://www.google.com.br")
       WebBrowser3.Navigate("http://www.google.com.br")
       WebBrowser4.Navigate("http://www.google.com.br")
       WebBrowser5.Navigate("http://www.google.com.br")
       WebBrowser6.Navigate("http://www.google.com.br")
       WebBrowser7.Navigate("http://www.google.com.br")
       WebBrowser8.Navigate("http://www.google.com.br")
       WebBrowser9.Navigate("http://www.google.com.br")
       WebBrowser10.Navigate("http://www.google.com.br")
       WebBrowser11.Navigate("http://www.google.com.br")
       WebBrowser12.Navigate("http://www.google.com.br")
       WebBrowser13.Navigate("http://www.google.com.br")
       WebBrowser14.Navigate("http://www.google.com.br")
       WebBrowser15.Navigate("http://www.google.com.br")
Posted 21-Jan-13 16:30pm
Comments
SoMad 21-Jan-13 22:37pm
   
You must have made a mistake. Please recheck the question you have posted.

Soren Madsen
R3dbrnu 21-Jan-13 22:44pm
   
'm sorry but I do not speak English fluently
But I would like to reduce size of code
Sergey Alexandrovich Kryukov 21-Jan-13 22:59pm
   
Just joking? Not funny, my 1.
—SA
R3dbrnu 21-Jan-13 23:02pm
   
I'm not...
SoMad 21-Jan-13 23:10pm
   
The problem is that the question you have posted is just 15 identical lines. Yes, I can see that they are individual objects, but you need to show more of your code and maybe explain why they all navigate to the same address.

Soren Madsen
Sergey Alexandrovich Kryukov 21-Jan-13 23:29pm
   
More?! As if you had not enough... :-)
—SA
SoMad 21-Jan-13 23:37pm
   
I know, but this can't be right.

Soren Madsen
Sergey Alexandrovich Kryukov 21-Jan-13 23:29pm
   
Answer would be more then obvious, a couple of lines, but if just looks like a joke. 15 Web browsers showing the same site... Huh?
—SA
R3dbrnu 21-Jan-13 23:12pm
   
But this code up much space ...
  i would like a way to make it take up less space
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I Don Know VB.net So Using C sharp

Since WebBrowser1,2,3....are objects u can create a list of WebBrowser class.
like

if class is in this structure

Public Class WebBrowser
{

public String Url{get; set;}

public Void Navigate(String path)
{
Url=path;
}
}

you created object of this class and called method like this

WebBrowser WebBrowser1=new WebBrowse();
WebBrowser WebBrowser2=new WebBrowse();
.
.
.
WebBrowser1.Navigate("http://www.google.com.br")
WebBrowser2.Navigate("http://www.google.com.br")
.
.
.
instead of this create list like this

List webBrowserList=new List();
for(i=0;i<=10;i++)
{
WebBrowser webBrowserObj=new WebBrowser();
webBrowserObj.Navigate("http://www.google.com.br[^]");
webBrowserList.Add(webBrowserObj);
}
  Permalink  
v3
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

If I Understand Correctly, Then It's my Solution...

You may Use For Each Loop, If all WebBrowser Controls Present in Same Container (Form, Panel, Tab Strip, Group Control or More Similar Control)
For Each Obj As Object In Form1.Controls
    If TypeOf(Obj) Is WebBrowser Then Obj.Navigate("www.google.com.br")
Next
Accept This Solution if it Help You in anyway...
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100