winforms - Creating Windows Forms labels within a tab control C# -


i'm working on project @ moment , i'm trying have every contact within arraylist has own tab page. within tab page want info displayed, i'm trying create labels have information. i'm right @ point trying @ least 1 label appear, not appear displaying @ all. code below. help?

            int count = 0;              foreach (clscontacthandler contact in clsglobal.mcontacts)             {                 string tabname = contact.firstname + " " + contact.lastname;                  font font = new font("microsoft sans serif", 16.0f, fontstyle.bold);                 tabpage contactpage = new tabpage(tabname);                 tabs.tabpages.add(tabname);                 label label = new label();                  contactpage.controls.add(label);                  label.font = font;                 label.autosize = true;                 label.location = new system.drawing.point(16, 7);                 label.name = "label" + count;                 label.size = new system.drawing.size(43, 13);                 label.text = "name:";                 count++;             } 

since you're creating new page tabpage contactpage object,

tabs.tabpages.add(tabname); 

should be

tabs.tabpages.add(contactpage); 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -