private void FillSection() { bool enable = !CheckPositionIsCompleted(); SectionTable.Controls.Clear(); RowStyle style = new RowStyle { SizeType = SizeType.AutoSize }; SectionTable.Padding = new Padding(0, 0, SystemInformation.VerticalScrollBarWidth, 0); HeaderControls.Padding = new Padding(0, 0, SystemInformation.VerticalScrollBarWidth, 0); SectionTable.RowStyles.Add(style); foreach (Section s in _currentFeed.Sections) { SectionTable.Controls.Add(new CheckBox { Anchor = AnchorStyles.Left, Name = "checker" + s.SectionId, AutoSize = true, Checked = (object.ReferenceEquals(s.IsChecked, null) ? false : s.IsChecked), Enabled = enable }, 0, row); SectionTable.Controls.Add( new Label { Text = s.Title, Anchor = AnchorStyles.Left, TextAlign = ContentAlignment.MiddleLeft, AutoSize = true }, 1, row); ComboBox codes = new ComboBox { DropDownStyle = ComboBoxStyle.DropDownList, Anchor = AnchorStyles.Right, Name = "codes" + s.SectionId, FlatStyle = FlatStyle.Flat, Enabled = enable }; foreach (string code in s.Codes) { codes.Items.Add(code); } if (!object.ReferenceEquals(s.CodeChosen, null)) { codes.SelectedItem = (s.Codes.Find(x => x.Equals(s.CodeChosen))); } SectionTable.Controls.Add(codes, 2, row); RichTextBox comment = new RichTextBox { Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top, Name = "comment" + s.SectionId, Text = (object.ReferenceEquals(s.Comment, null) ? null : s.Comment), Enabled = enable }; SectionTable.Controls.Add(comment, 1, row + 1); SectionTable.SetColumnSpan(comment, 2); row++; row++; } }