开发者

TabControl winform c#

Does anyone know why my tabcontrol will not display on this form? Have a feeling it maybe something simple but at the moment i just get a blank form.

Thanks

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 test_project_3
{
    public partial class TabTest : Form
    {
开发者_JAVA百科        public TabTest()
        {
            InitializeComponent();

            WebBrowser WB = new WebBrowser();
            WB.Navigate("www.google.com");

            TabControl tc = new TabControl();
            tc.Dock = DockStyle.Fill;
            tc.Show();

            TabPage tp = new TabPage();
            tp.Text = "test";
            tp.Show();
            tp.Controls.Add(WB);

            tc.TabPages.Add(tp);
        }
    }
}


You need to add the TabControl to the Controls collection:

this.Controls.Add(tc);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜