Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / December 2007

Tip: Looking for answers? Try searching our database.

webbrowser with tabcontrol

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RobcPettit@yahoo.co.uk - 23 Dec 2007 22:32 GMT
Hi, Ive  added a tabcontrol to form1 and a webbrowser to tabpage, but
I cant see my page. Im using this in form load.
webBrowser1.Navigate("http://www.oddschecker.com/bet-basket"); Ive
checked the address, and Ive tried it with webbrowser in a form and it
works. Its firing private void webBrowser1_DocumentCompleted, so tits
trying. Is there something I have to add because its in a tabpage.
Regads Robert
Marc Gravell - 24 Dec 2007 09:11 GMT
Nothing special... see below which hosts 5 browsers on tabs; note that
WebBrowser might not truly load if it isn't Visible. Check that your
browser is actually *inside* the tab page, and not behind it. The
"Document Outline" window can make this easier to see.

Marc

using System;
using System.Windows.Forms;

static class Program {
   [STAThread]
   static void Main() {
       Application.EnableVisualStyles();
       using (Form f = new Form())
       using (TabControl tc = new TabControl()) {
           for (int i = 0; i < 5; i++) {
               TabPage page = new TabPage("Page " + i.ToString());
               tc.TabPages.Add(page);
               WebBrowser wb = new WebBrowser();
               wb.Name = "WB" + i.ToString();
               f.Load += delegate {
                   wb.Navigate(@"http://www.google.com");
               };
               wb.DocumentCompleted += delegate {
                   f.Text += ";" + wb.Name;
               };
               wb.Dock = DockStyle.Fill;
               page.Controls.Add(wb);
           }
           tc.Dock = DockStyle.Fill;
           f.Controls.Add(tc);
           Application.Run(f);
       }
   }
}

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.