I want to change the tab text to the document title of the current webbrowser each time a new page is loaded. So far, I haven't been able to get it. Any pointers in the right direction? Not looking for the answer, just for a bit of guidance.
Heres my code:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Settings1 set = new Settings1();
string url = set.home;
Uri uri = new Uri(url);
for (int i = 0; i <= tabControl1.TabCount - 1; i++)
{
WebBrowser web = new WebBrowser();
web.Size = tabControl1.TabPages[i].Size;
web.Url = uri;
web.Name = "Webbrowser"+i.ToString();
tabControl1.TabPages[i].Controls.Add(web);
}
}
private void Form1_SizeChanged(object sender, EventArgs e)
{
tabControl1.Height = this.Height - 20;
tabControl1.Width = this.Width;
for (int i = 0; i <= tabControl1.TabCount - 1; i++)
{
tabControl1.TabPages[i].Height = tabControl1.Size.Height;
tabControl1.TabPages[i].Width = tabControl1.Size.Width;
Control[] controls = tabControl1.TabPages[i].Controls.Find("Webbrowser" + i.ToString(), true);
foreach (Control a in controls)
{
if (a is WebBrowser)
{
a.Size = tabControl1.TabPages[i].Size;
}
}
}
}
}
}