public void LoadDynamicMenu(string username, string PCC) { List <Rol> rolList = RolesBL.GetRolesByUser(username, PCC); roles = Array.ConvertAll <Rol, string>(rolList.ToArray(), delegate(Rol from) { return(from.RoleName.ToString()); }); //roles = Roles.GetRolesForUser(username); //roles = new string[] { "admin", "" }; List <ApplicationObjects> applicationObjects = MyCTS.Forms.UI.DataAccess.Security.GetMenuData(); List <ApplicationObjects> parentObjects = GetParents(applicationObjects); foreach (ApplicationObjects item in parentObjects) { ToolStripMenuItemExtended menu = new ToolStripMenuItemExtended(); menu.Name = item.Name; menu.Text = item.Text; menu.Value = item.ID.ToString(); menu.Width = 55; menu.AutoSize = false; this.Items.Add(menu); AddChild(applicationObjects, (ToolStripMenuItemExtended)this.Items[this.Items.Count - 1]); } }