Hi,
I'm trying to programmatically create tabs, and then add some controls to it but i'm having some issues I hope I can get some help with.
foreach (DataRow row in dtModules.Rows)
{
string tabName = row["mod_Name"].ToString();
utMainTab.Tabs.Add(tabName, tabName);
string imagePath = APPLICATION_PATH + "Images\\" + row["mod_Image"].ToString();
utMainTab.Tabs[tabName].Appearance.Image = Image.FromFile(imagePath);
utMainTab.ImageSize = new Size(20, 20);
Label lbl = new Label();
lbl.Text = "new";
utMainTab.Controls[tabName].Controls.Add(lbl);
}
I get a NullReferenceException on the last line:
Use this:
utMainTab.Tabs[tabName].TabPage.Controls.Add(lbl);