private void navBarControl1_LinkClicked(object sender, NavBarLinkEventArgs e) { PanelContainer.Controls.Clear(); int a=1; char[] chars = e.Link.Caption.ToCharArray(); if (chars[0] == 'М') { a = 41; } else { if (chars[0] == 'А') { a = 42; } else { if (chars[0] == 'К') { a = 43; } } } if (a < 41) { { a = Convert.ToInt32(chars[0].ToString()); if (chars[1] > 46 && chars[1] < 58) { a = a * 10 + Convert.ToInt32(chars[1].ToString()); } } } List<Question> questions = DbController.GetInstance().GetQuestionsByGroupId(a); aa = questions.Count; List<Grouping> groupResponse = DbController.GetInstance().GetGroupByGroupID(a); splitContainerControl1.Panel2.Text = groupResponse[0].groupName + ": Нийт Асуулт:" + aa.ToString(); for (int i = aa - 1; i >= 0; i--) { UcQuestionRead us = new UcQuestionRead(i + 1, questions[i]); us.Dock = DockStyle.Top; us.AutoSize = true; PanelContainer.Controls.Add(us); } }
public ReadForm() { InitializeComponent(); List<Question> questions = DbController.GetInstance().GetQuestionsByGroupId(1); aa = questions.Count; List<Grouping> groupResponse = DbController.GetInstance().GetGroupByGroupID(1); splitContainerControl1.Panel2.Text = groupResponse[0].groupName + ": Нийт Асуулт:" + aa.ToString(); for (int i = aa-1; i >= 0; i--) { UcQuestionRead us = new UcQuestionRead(i + 1, questions[i]); us.Dock = DockStyle.Top; us.AutoSize = true; PanelContainer.Controls.Add(us); } }